Browse Source

Use tools from .NET 4.5 SDK if available.

pull/28/head
Daniel Grunwald 13 years ago
parent
commit
a4038fc1a1
  1. 32
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

32
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -61,6 +61,22 @@ namespace ICSharpCode.Core @@ -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 @@ -154,6 +170,18 @@ namespace ICSharpCode.Core
}
}
static string windowsSdk80InstallRoot = null;
/// <summary>
/// Location of the .NET 4.5 SDK (Windows SDK 8.0) install root.
/// </summary>
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 @@ -216,6 +244,10 @@ namespace ICSharpCode.Core
/// <returns>The path of the executable, or null if the exe is not found.</returns>
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; }

Loading…
Cancel
Save