From c7dcdee05527f9b93f30414544254990dbc68f0c Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 29 Aug 2016 17:43:30 +0100 Subject: [PATCH] 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) --- install/StyleCop.nuspec | 7 +++- .../Options/StyleCopOptionsPage.cs | 39 +++++++++++++++---- .../StyleCop.ReSharper.csproj | 3 +- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/install/StyleCop.nuspec b/install/StyleCop.nuspec index f5dae8a..f687efd 100644 --- a/install/StyleCop.nuspec +++ b/install/StyleCop.nuspec @@ -3,15 +3,18 @@ StyleCop.StyleCop StyleCop by JetBrains - 2016.1.2 + 2016.1.3 Matt Ellis, Andy Reeves JetBrains, Matt Ellis StyleCop analyzes C# source code to enforce a set of style and consistency rules. Maintained by JetBrains 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. +• Better version number reporting + +From 2016.1.2: • Updated to StyleCop 4.7.54 (StyleCop/StyleCop#52) -From 2016.1.1 +From 2016.1.1: • Suppress message quick fix available again (StyleCop/StyleCop#59) • Fix duplicate warning tooltips (StyleCop/StyleCop#34) • Fix insert header documentation quick fix (StyleCop/StyleCop#57) diff --git a/src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs b/src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs index ef7711f..5926b81 100644 --- a/src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs +++ b/src/StyleCop.ReSharper/Options/StyleCopOptionsPage.cs @@ -18,7 +18,9 @@ namespace StyleCop.ReSharper.Options { + using System; using System.Diagnostics; + using System.Drawing; using System.Reflection; using JetBrains.Application.Components; @@ -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; @@ -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 @@ -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 pluginsPath = this.SetupPluginsPathProperty(lifetime); FileChooserViewModel fileChooser = this.AddFolderChooserOption( @@ -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; diff --git a/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj b/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj index 2e7adc5..49c73d9 100644 --- a/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj +++ b/src/StyleCop.ReSharper/StyleCop.ReSharper.csproj @@ -154,6 +154,7 @@ + @@ -522,4 +523,4 @@ --> - + \ No newline at end of file