Add support for ToolsVersion and correctly build msbuild+xbuild assemblies
[mono.git] / mcs / class / Microsoft.Build.Engine / Test / Microsoft.Build.BuildEngine / Consts.cs
index 4534c7b8086e382955af9e499f9265e16f728ba5..31a160850a170cd7bbc08aaa2667bfddfd8078c2 100644 (file)
 // 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 { return "../../tools/xbuild/xbuild"; }
+               get {
+                       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
        }
 }