Merge pull request #2841 from lambdageek/dev/bug-40060
[mono.git] / mcs / tools / xbuild / SolutionParser.cs
index 92fd84e949d0ac102aa1e063853fa29e8318288c..44ac70d2f963f328fd8bb2ad840912446e262454 100644 (file)
@@ -121,7 +121,9 @@ namespace Mono.XBuild.CommandLine {
                        string slnVersion = GetSlnFileVersion (reader);
 
                        if (slnVersion == "12.00")
-#if XBUILD_12
+#if XBUILD_14
+                               p.DefaultToolsVersion = "14.0";
+#elif XBUILD_12
                                p.DefaultToolsVersion = "12.0";
 #else
                                p.DefaultToolsVersion = "4.0";
@@ -262,6 +264,10 @@ namespace Mono.XBuild.CommandLine {
                                        if (info != null)
                                                projectInfo.Dependencies [info.Guid] = info;
                                }
+
+                               // unload the project after reading info from it
+                               // it'll be reloaded with proper context when building the solution
+                               p.ParentEngine.UnloadProject (currentProject);
                        }
 
                        // fill in the project info for deps found in the .sln file
@@ -347,11 +353,9 @@ namespace Mono.XBuild.CommandLine {
 
                void EmitBeforeImports (Project p, string file)
                {
-#if NET_4_0
                        p.AddNewImport ("$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\SolutionFile\\ImportBefore\\*",
                                        "'$(ImportByWildcardBeforeSolution)' != 'false' and " +
                                        "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\SolutionFile\\ImportBefore')");
-#endif
 
                        string before_filename = Path.Combine (Path.GetDirectoryName (file), "before." + Path.GetFileName (file) + ".targets");
                        p.AddNewImport (before_filename, String.Format ("Exists ('{0}')", before_filename));
@@ -359,11 +363,9 @@ namespace Mono.XBuild.CommandLine {
 
                void EmitAfterImports (Project p, string file)
                {
-#if NET_4_0
                        p.AddNewImport ("$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\SolutionFile\\ImportAfter\\*",
                                        "'$(ImportByWildcardAfterSolution)' != 'false' and " +
                                        "Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\SolutionFile\\ImportAfter')");
-#endif
 
                        string after_filename = Path.Combine (Path.GetDirectoryName (file), "after." + Path.GetFileName (file) + ".targets");
                        p.AddNewImport (after_filename, String.Format ("Exists ('{0}')", after_filename));
@@ -508,8 +510,8 @@ namespace Mono.XBuild.CommandLine {
                                if (solutionTarget.Configuration == targetInfo.Key.Configuration &&
                                                solutionTarget.Platform == targetInfo.Key.Platform) {
                                        solutionConfigurationContents.AppendFormat (
-                                                       "<ProjectConfiguration Project=\"{0}\">{1}|{2}</ProjectConfiguration>",
-                                       guid.ToString ("B").ToUpper (), targetInfo.Value.Configuration, targetInfo.Value.Platform);
+                                                       "<ProjectConfiguration Project=\"{0}\" AbsolutePath=\"{1}\">{2}|{3}</ProjectConfiguration>",
+                                                       guid.ToString ("B").ToUpper (), projectInfo.FileName, targetInfo.Value.Configuration, targetInfo.Value.Platform);
                                }
                        }
                }