[xbuild] Make Engine.DefaultToolsVersion 2.0 .
authorAnkit Jain <radical@corewars.org>
Mon, 28 Feb 2011 10:51:18 +0000 (16:21 +0530)
committerAnkit Jain <radical@corewars.org>
Mon, 28 Feb 2011 10:51:18 +0000 (16:21 +0530)
Engine.DefaultToolsVersion is used when a project is unable
to determine a suitable ToolsVersion to use. Change this fallback
version to 2.0 . This allows vs2005 (.net 2.0) projects which
don't have ToolsVersion explicitly set, to build. Newer projects
set ToolsVersion by default.

mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs

index 8f7bc6d4b7a275abf033e796ae806318024f3506..239118910a277e63707b74a82afb515da34f3f3a 100644 (file)
@@ -518,16 +518,14 @@ namespace Microsoft.Build.BuildEngine {
 
                public string DefaultToolsVersion {
                        get {
-                               if (String.IsNullOrEmpty (defaultToolsVersion))
-#if NET_4_0
-                                       return "4.0";
-#elif NET_3_5
-                                       return "3.5";
-#else
-                                       return "2.0";
-#endif
-                               
-                               return defaultToolsVersion;
+                               // This is used as the fall back version if the
+                               // project can't find a version to use
+                               // Hard-coded to 2.0, so it allows even vs2005 projects
+                               // to build correctly, as they won't have a ToolsVersion
+                               // set!
+                               return String.IsNullOrEmpty (defaultToolsVersion)
+                                               ? "2.0"
+                                               : defaultToolsVersion;
                        }
                        set {
                                if (Toolsets [value] == null)