Add support for ToolsVersion and correctly build msbuild+xbuild assemblies
[mono.git] / mcs / class / Microsoft.Build.Engine / Test / Microsoft.Build.BuildEngine / Consts.cs
index 12c1a0fbcef9062fd8069b7bc83e30d516355db5..31a160850a170cd7bbc08aaa2667bfddfd8078c2 100644 (file)
 // 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 {
-                       // FIXME: it should check for runtime not OS
-                       int p = (int) Environment.OSVersion.Platform;
-                       if (p == 4 || p == 128)
+                       if (RunningOnMono ())
                                return "../../tools/xbuild/xbuild";
                        else
                                return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20);
                }
        }
+
+       public static string ToolsVersionString {
+               get {
+#if NET_4_0
+                       return " ToolsVersion='4.0'";
+#elif NET_3_5
+                       return " ToolsVersion='3.5'";
+#else
+                       return String.Empty;
+#endif
+               }
+       }
+
+       public static string GetTasksAsmPath ()
+       {
+#if NET_4_0
+               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version40), "Microsoft.Build.Tasks.v4.0.dll");
+#elif NET_3_5
+               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version35), "Microsoft.Build.Tasks.v3.5.dll");
+#else
+               return Path.Combine (ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version20), "Microsoft.Build.Tasks.dll");
+#endif
+       }
 }