From VS2013, MSBuild is now decouple from the .NET Framework and is a separate redistributable. This means it has a new location and version numbering scheme. There are also some addition MSBuild properties because of this
#if NET_4_0
Toolsets.Add (new Toolset ("4.0",
ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40)));
+#endif
+#if NET_4_5
+ Toolsets.Add (new Toolset("12.0",
+ ToolLocationHelper.GetMSBuildInstallPath ("12.0"),
+ ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40)));
#endif
}
SetExtensionsPathProperties (DefaultExtensionsPath);
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved));
evaluatedProperties.AddProperty (new BuildProperty ("OS", OS, PropertyType.Environment));
-
+#if NET_4_5
+ // see http://msdn.microsoft.com/en-us/library/vstudio/hh162058(v=vs.120).aspx
+ if (effective_tools_version == "12.0") {
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath32", toolsPath, PropertyType.Reserved));
+ string frameworkToolsPath = parentEngine.Toolsets [effective_tools_version].FrameworkToolsPath;
+ if (frameworkToolsPath == null)
+ throw new Exception (String.Format ("Invalid tools version '{0}', no framework tools path set for this.", effective_tools_version));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath", frameworkToolsPath, PropertyType.Reserved));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildFrameworkToolsPath32", frameworkToolsPath, PropertyType.Reserved));
+ }
+#endif
// FIXME: make some internal method that will work like GetDirectoryName but output String.Empty on null/String.Empty
string projectDir;
if (FullFileName == String.Empty)
{
public class Toolset
{
- public Toolset (string toolsVersion, string toolsPath, BuildPropertyGroup buildProperties)
+ public Toolset (string toolsVersion, string toolsPath, string toolsFrameworkPath, BuildPropertyGroup buildProperties)
{
ToolsVersion = toolsVersion;
ToolsPath = toolsPath;
+ FrameworkToolsPath = toolsFrameworkPath;
BuildProperties = buildProperties;
}
-
- public Toolset (string toolsVersion, string toolsPath)
- : this (toolsVersion, toolsPath, null)
+
+ public Toolset (string toolsVersion, string toolsPath, string toolsFrameworkPath)
+ : this (toolsVersion, toolsPath, toolsFrameworkPath, null)
+ {
+ }
+
+ public Toolset(string toolsVersion, string toolsPath)
+ : this (toolsVersion, toolsPath, toolsPath)
{
}
public string ToolsVersion { get; private set; }
public string ToolsPath { get; private set; }
+ public string FrameworkToolsPath { get; private set; }
}
}
t2 = t1.Parent;
lib_mono_dir = t2.FullName;
+ var windowsPath = Environment.GetFolderPath (Environment.SpecialFolder.Windows);
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null) {
mono_dir = new string [] {
Path.Combine (lib_mono_dir, "net_1_0"),
Path.Combine (lib_mono_dir, "net_4_0"),
Path.Combine (lib_mono_dir, "net_4_5")
};
+ } else if (!string.IsNullOrEmpty (windowsPath) && lib_mono_dir.StartsWith (windowsPath)) {
+ //running in .NET, not Mono
+ mono_dir = new string [] {
+ Path.Combine (lib_mono_dir, "v1.0.3705"),
+ Path.Combine (lib_mono_dir, "v2.0.50727"),
+ Path.Combine (lib_mono_dir, "v2.0.50727"),
+ Path.Combine (lib_mono_dir, "v3.5"),
+ Path.Combine (lib_mono_dir, "v4.0.30319"),
+ Path.Combine (lib_mono_dir, "v4.0.30319")
+ };
} else {
mono_dir = new string [] {
Path.Combine (lib_mono_dir, "1.0"),
return mono_dir [(int)version];
}
+ public static string GetMSBuildInstallPath (string version)
+ {
+ //see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx
+ var programFiles = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
+ return Path.Combine (programFiles, "MSBuild", version, "bin");
+ }
+
[MonoTODO]
public static string GetPathToDotNetFrameworkFile (string fileName,
TargetDotNetFrameworkVersion version)