Skip to content

Commit c7dcdee

Browse files
committed
More useful version information on options page
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)
1 parent a6644ba commit c7dcdee

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

install/StyleCop.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
<metadata>
44
<id>StyleCop.StyleCop</id>
55
<title>StyleCop by JetBrains</title>
6-
<version>2016.1.2</version>
6+
<version>2016.1.3</version>
77
<authors>Matt Ellis, Andy Reeves</authors>
88
<owners>JetBrains, Matt Ellis</owners>
99
<summary>StyleCop analyzes C# source code to enforce a set of style and consistency rules. Maintained by JetBrains</summary>
1010
<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>
1111
<releaseNotes>
12+
&#8226; Better version number reporting
13+
14+
From 2016.1.2:
1215
&#8226; Updated to StyleCop 4.7.54 (StyleCop/StyleCop#52)
1316

14-
From 2016.1.1
17+
From 2016.1.1:
1518
&#8226; Suppress message quick fix available again (StyleCop/StyleCop#59)
1619
&#8226; Fix duplicate warning tooltips (StyleCop/StyleCop#34)
1720
&#8226; Fix insert header documentation quick fix (StyleCop/StyleCop#57)

src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
namespace StyleCop.ReSharper.Options
2020
{
21+
using System;
2122
using System.Diagnostics;
23+
using System.Drawing;
2224
using System.Reflection;
2325

2426
using JetBrains.Application.Components;
@@ -31,6 +33,7 @@ namespace StyleCop.ReSharper.Options
3133
using JetBrains.UI.Options;
3234
using JetBrains.UI.Options.OptionsDialog2.SimpleOptions;
3335
using JetBrains.UI.Options.OptionsDialog2.SimpleOptions.ViewModel;
36+
using JetBrains.UI.RichText;
3437
using JetBrains.Util;
3538
using JetBrains.VsIntegration.Shell;
3639

@@ -76,6 +79,25 @@ public StyleCopOptionsPage(
7679
this.originalPluginsPath =
7780
settingsContext.GetValue((StyleCopOptionsSettingsKey options) => options.PluginsPath);
7881

82+
this.AddHeader("Version");
83+
84+
Assembly assembly = typeof(StyleCopEnvironment).Assembly;
85+
string styleCopFileVersion = GetFileVersionInfo(assembly);
86+
this.AddText(string.Format("StyleCop.dll {0} ({1})", assembly.GetName().Version, styleCopFileVersion));
87+
88+
assembly = this.GetType().Assembly;
89+
string ourFileVersion = GetFileVersionInfo(assembly);
90+
this.AddText(string.Format("StyleCop.ReSharper.dll {0} ({1})", assembly.GetName().Version, ourFileVersion));
91+
92+
if (ourFileVersion != styleCopFileVersion)
93+
{
94+
TextStyle style = new TextStyle(FontStyle.Bold, Color.Empty, Color.Empty);
95+
this.AddRichText(
96+
new RichText(
97+
"Mismatched StyleCop.dll version! Are you running an older version of the Visual Studio plugin?",
98+
style));
99+
}
100+
79101
this.AddHeader("Options");
80102

81103
// Note that we have to check to see if the lifetime is terminated before accessing the
@@ -125,13 +147,6 @@ public StyleCopOptionsPage(
125147
this.AddBoolOption(
126148
(StyleCopOptionsSettingsKey options) => options.PluginsEnabled,
127149
"Enable StyleCop plugins");
128-
Assembly assembly = typeof(StyleCopEnvironment).Assembly;
129-
string fileVersion = "";
130-
if (assembly.Location != null)
131-
{
132-
fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
133-
}
134-
this.AddText(string.Format("Plugins need to target StyleCop {0}", fileVersion));
135150
this.AddText("Location of StyleCop plugins:");
136151
Property<FileSystemPath> pluginsPath = this.SetupPluginsPathProperty(lifetime);
137152
FileChooserViewModel fileChooser = this.AddFolderChooserOption(
@@ -181,6 +196,16 @@ public override bool OnOk()
181196
return base.OnOk();
182197
}
183198

199+
private static string GetFileVersionInfo(Assembly assembly)
200+
{
201+
if (assembly.Location != null)
202+
{
203+
return FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
204+
}
205+
206+
return String.Empty;
207+
}
208+
184209
private static bool DoesHostSupportRoslynAnalzyers(IComponentContainer container)
185210
{
186211
bool hostSupportsRoslynAnalzyers = false;

src/StyleCop.ReSharper/StyleCop.ReSharper.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
</Reference>
155155
<Reference Include="System" />
156156
<Reference Include="System.Core" />
157+
<Reference Include="System.Drawing" />
157158
<Reference Include="System.Web" />
158159
<Reference Include="System.Windows.Forms" />
159160
<Reference Include="System.Windows.Interactivity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -522,4 +523,4 @@
522523
<Target Name="AfterBuild">
523524
</Target>
524525
-->
525-
</Project>
526+
</Project>

0 commit comments

Comments
 (0)