Skip to content

Commit

Permalink
More useful version information on options page
Browse files Browse the repository at this point in the history
Include both the assembly version and the file version, as the assembly version is fixed (i.e. 4.7.49 and 4.7.54 are both file versions of StyleCop.dll - the assembly version is 4.7.1000)
  • Loading branch information
citizenmatt committed Aug 29, 2016
1 parent a6644ba commit c7dcdee
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
7 changes: 5 additions & 2 deletions install/StyleCop.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
<metadata>
<id>StyleCop.StyleCop</id>
<title>StyleCop by JetBrains</title>
<version>2016.1.2</version>
<version>2016.1.3</version>
<authors>Matt Ellis, Andy Reeves</authors>
<owners>JetBrains, Matt Ellis</owners>
<summary>StyleCop analyzes C# source code to enforce a set of style and consistency rules. Maintained by JetBrains</summary>
<description>StyleCop analyzes C# source code to enforce a set of style and consistency rules. This plugin is compatible with StyleCop 4.7.54, and maintained by JetBrains.</description>
<releaseNotes>
&#8226; Better version number reporting

From 2016.1.2:
&#8226; Updated to StyleCop 4.7.54 (StyleCop/StyleCop#52)

From 2016.1.1
From 2016.1.1:
&#8226; Suppress message quick fix available again (StyleCop/StyleCop#59)
&#8226; Fix duplicate warning tooltips (StyleCop/StyleCop#34)
&#8226; Fix insert header documentation quick fix (StyleCop/StyleCop#57)
Expand Down
39 changes: 32 additions & 7 deletions src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

namespace StyleCop.ReSharper.Options
{
using System;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;

using JetBrains.Application.Components;
Expand All @@ -31,6 +33,7 @@ namespace StyleCop.ReSharper.Options
using JetBrains.UI.Options;
using JetBrains.UI.Options.OptionsDialog2.SimpleOptions;
using JetBrains.UI.Options.OptionsDialog2.SimpleOptions.ViewModel;
using JetBrains.UI.RichText;
using JetBrains.Util;
using JetBrains.VsIntegration.Shell;

Expand Down Expand Up @@ -76,6 +79,25 @@ public StyleCopOptionsPage(
this.originalPluginsPath =
settingsContext.GetValue((StyleCopOptionsSettingsKey options) => options.PluginsPath);

this.AddHeader("Version");

Assembly assembly = typeof(StyleCopEnvironment).Assembly;
string styleCopFileVersion = GetFileVersionInfo(assembly);
this.AddText(string.Format("StyleCop.dll {0} ({1})", assembly.GetName().Version, styleCopFileVersion));

assembly = this.GetType().Assembly;
string ourFileVersion = GetFileVersionInfo(assembly);
this.AddText(string.Format("StyleCop.ReSharper.dll {0} ({1})", assembly.GetName().Version, ourFileVersion));

if (ourFileVersion != styleCopFileVersion)
{
TextStyle style = new TextStyle(FontStyle.Bold, Color.Empty, Color.Empty);
this.AddRichText(
new RichText(
"Mismatched StyleCop.dll version! Are you running an older version of the Visual Studio plugin?",
style));
}

this.AddHeader("Options");

// Note that we have to check to see if the lifetime is terminated before accessing the
Expand Down Expand Up @@ -125,13 +147,6 @@ public StyleCopOptionsPage(
this.AddBoolOption(
(StyleCopOptionsSettingsKey options) => options.PluginsEnabled,
"Enable StyleCop plugins");
Assembly assembly = typeof(StyleCopEnvironment).Assembly;
string fileVersion = "";
if (assembly.Location != null)
{
fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
}
this.AddText(string.Format("Plugins need to target StyleCop {0}", fileVersion));
this.AddText("Location of StyleCop plugins:");
Property<FileSystemPath> pluginsPath = this.SetupPluginsPathProperty(lifetime);
FileChooserViewModel fileChooser = this.AddFolderChooserOption(
Expand Down Expand Up @@ -181,6 +196,16 @@ public override bool OnOk()
return base.OnOk();
}

private static string GetFileVersionInfo(Assembly assembly)
{
if (assembly.Location != null)
{
return FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
}

return String.Empty;
}

private static bool DoesHostSupportRoslynAnalzyers(IComponentContainer container)
{
bool hostSupportsRoslynAnalzyers = false;
Expand Down
3 changes: 2 additions & 1 deletion src/StyleCop.ReSharper/StyleCop.ReSharper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -522,4 +523,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

0 comments on commit c7dcdee

Please sign in to comment.