Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 433cde2

Browse files
committed
If MSBuild 12.0 is installed, use it for all .NET 4.x projects.
1 parent ff6ac4c commit 433cde2

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/Main/Base/Project/Util/DotnetDetection.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,16 @@ public static bool IsDotnet451Installed()
6969
}
7070
return null;
7171
}
72+
73+
/// <summary>
74+
/// Gets whether the Microsoft Build Tools 2013 (MSBuild 12.0) is installed.
75+
/// </summary>
76+
public static bool IsBuildTools2013Installed()
77+
{
78+
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\BuildTools\Servicing\12.0
79+
using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\DevDiv\BuildTools\Servicing\12.0\MSBuild")) {
80+
return key != null && key.GetValue("Install") as int? >= 1;
81+
}
82+
}
7283
}
7384
}

src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngineWorker.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ internal Task<bool> RunBuildAsync(CancellationToken cancellationToken)
159159
loggerChain.HandleError(new BuildError(job.ProjectFileName, ".NET 3.5 SP1 is required to build this project."));
160160
tcs.SetResult(false);
161161
}
162-
} else if (projectMinimumSolutionVersion <= SolutionFormatVersion.VS2010) {
163-
BuildWorkerManager.MSBuild40.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
164162
} else {
165-
BuildWorkerManager.MSBuild120.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
163+
if (DotnetDetection.IsBuildTools2013Installed()) {
164+
BuildWorkerManager.MSBuild120.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
165+
} else {
166+
BuildWorkerManager.MSBuild40.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
167+
}
166168
}
167169
return tcs.Task;
168170
}

0 commit comments

Comments
 (0)