2014-08-13 10:39:27 +01:00
|
|
|
//
|
|
|
|
// Consts.cs
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// Marek Sieradzki (marek.sieradzki@gmail.com)
|
|
|
|
//
|
|
|
|
// (C) 2006 Marek Sieradzki
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
// a copy of this software and associated documentation files (the
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
// permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
// the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be
|
|
|
|
// included in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using Microsoft.Build.Utilities;
|
|
|
|
|
|
|
|
public static class Consts {
|
|
|
|
|
|
|
|
public static bool RunningOnMono ()
|
|
|
|
{
|
|
|
|
return Type.GetType ("Mono.Runtime") != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string BinPath {
|
|
|
|
get {
|
|
|
|
if (RunningOnMono ()) {
|
2015-04-07 09:35:12 +01:00
|
|
|
#if XBUILD_14
|
|
|
|
string profile = "xbuild_14";
|
|
|
|
#elif XBUILD_12
|
2014-08-13 10:39:27 +01:00
|
|
|
string profile = "xbuild_12";
|
|
|
|
#elif NET_4_5
|
|
|
|
string profile = "net_4_5";
|
|
|
|
#elif NET_4_0
|
|
|
|
string profile = "net_4_0";
|
|
|
|
#else
|
|
|
|
string profile = "net_2_0";
|
|
|
|
#endif
|
|
|
|
var corlib = typeof (object).Assembly.Location;
|
|
|
|
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
|
|
|
|
return Path.Combine (lib, profile);
|
|
|
|
} else {
|
2015-04-07 09:35:12 +01:00
|
|
|
#if XBUILD_14
|
|
|
|
return ToolLocationHelper.GetPathToBuildTools ("14.0");
|
|
|
|
#elif XBUILD_12
|
2014-08-13 10:39:27 +01:00
|
|
|
return ToolLocationHelper.GetPathToBuildTools ("12.0");
|
|
|
|
#elif NET_4_5
|
|
|
|
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
|
|
|
|
#elif NET_4_0
|
|
|
|
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40);
|
|
|
|
#else
|
|
|
|
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string ToolsVersionString {
|
|
|
|
get {
|
2015-04-07 09:35:12 +01:00
|
|
|
#if XBUILD_14
|
|
|
|
return " ToolsVersion='14.0'";
|
|
|
|
#elif XBUILD_12
|
2014-08-13 10:39:27 +01:00
|
|
|
return " ToolsVersion='12.0'";
|
|
|
|
#elif NET_4_0
|
|
|
|
return " ToolsVersion='4.0'";
|
|
|
|
#else
|
|
|
|
return String.Empty;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string GetTasksAsmPath ()
|
|
|
|
{
|
2015-04-07 09:35:12 +01:00
|
|
|
#if XBUILD_14
|
|
|
|
return Path.Combine (BinPath, "Microsoft.Build.Tasks.Core.dll");
|
|
|
|
#elif XBUILD_12
|
2014-08-13 10:39:27 +01:00
|
|
|
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
|
|
|
|
#elif NET_4_0
|
|
|
|
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
|
|
|
|
#else
|
|
|
|
return Path.Combine (BinPath, "Microsoft.Build.Tasks.dll");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|