diff --git a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs index c46eb8982a..674aabb6a9 100644 --- a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs +++ b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs @@ -61,6 +61,22 @@ namespace ICSharpCode.Core return null; } + static string GetPathFromRegistryX86(string key, string valueName) + { + using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) { + using (RegistryKey installRootKey = baseKey.OpenSubKey(key)) { + if (installRootKey != null) { + object o = installRootKey.GetValue(valueName); + if (o != null) { + string r = o.ToString(); + if (!string.IsNullOrEmpty(r)) + return r; + } + } + } + } + return null; + } #region InstallRoot Properties static string netFrameworkInstallRoot = null; @@ -154,6 +170,18 @@ namespace ICSharpCode.Core } } + static string windowsSdk80InstallRoot = null; + /// + /// Location of the .NET 4.5 SDK (Windows SDK 8.0) install root. + /// + public static string WindowsSdk80NetFxTools { + get { + if (windowsSdk80InstallRoot == null) { + windowsSdk80InstallRoot = GetPathFromRegistryX86(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools", "InstallationFolder") ?? string.Empty; + } + return windowsSdk80InstallRoot; + } + } #endregion [Obsolete("Use System.IO.Path.Combine instead")] @@ -216,6 +244,10 @@ namespace ICSharpCode.Core /// The path of the executable, or null if the exe is not found. public static string GetSdkPath(string exeName) { string execPath; + if (!string.IsNullOrEmpty(WindowsSdk80NetFxTools)) { + execPath = Path.Combine(WindowsSdk80NetFxTools, exeName); + if (File.Exists(execPath)) { return execPath; } + } if (!string.IsNullOrEmpty(WindowsSdk71InstallRoot)) { execPath = Path.Combine(WindowsSdk71InstallRoot, "bin\\" + exeName); if (File.Exists(execPath)) { return execPath; }