From 11575009d5dd561876301ff0ca765890c5c9feaf Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sat, 20 Dec 2008 17:02:06 +0000 Subject: [PATCH] Path to FxCop 1.36 now detected. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3703 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/CodeAnalysis/Src/FxCopWrapper.cs | 6 +++++- .../ICSharpCode.Build.Tasks/Project/FxCop.cs | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs b/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs index 44e27a73dc..b2b63447f1 100644 --- a/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs +++ b/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs @@ -104,7 +104,11 @@ namespace ICSharpCode.CodeAnalysis if (IsFxCopPath(fxCopPath)) { return fxCopPath; } - + + fxCopPath = FromRegistry(Registry.ClassesRoot.OpenSubKey(@"FxCop.Project.9.0\Shell\Open\Command")); + if (IsFxCopPath(fxCopPath)) { + return fxCopPath; + } fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command")); if (IsFxCopPath(fxCopPath)) { return fxCopPath; diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs b/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs index acb7ed64a5..7257f8ad23 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs @@ -169,7 +169,7 @@ namespace ICSharpCode.Build.Tasks fxCopPath = key.GetValue("FxCopDir") as string; } } - if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + if (IsFxCopPath(fxCopPath)) { return fxCopPath; } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\EDev")) { @@ -177,21 +177,30 @@ namespace ICSharpCode.Build.Tasks fxCopPath = key.GetValue("FxCopDir") as string; } } - if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + if (IsFxCopPath(fxCopPath)) { + return fxCopPath; + } + + fxCopPath = FromRegistry(Registry.ClassesRoot.OpenSubKey(@"FxCop.Project.9.0\Shell\Open\Command")); + if (IsFxCopPath(fxCopPath)) { return fxCopPath; } - fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command")); - if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + if (IsFxCopPath(fxCopPath)) { return fxCopPath; } fxCopPath = FromRegistry(Registry.ClassesRoot.OpenSubKey(@"FxCopProject\Shell\Open\Command")); - if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + if (IsFxCopPath(fxCopPath)) { return fxCopPath; } return null; } + bool IsFxCopPath(string fxCopPath) + { + return !string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName)); + } + string FromRegistry(RegistryKey key) { // Code duplication: FxCopWrapper.cs in CodeAnalysis addin