Skip to content

Commit

Permalink
Use MSBuild 14.0 if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Jun 5, 2016
1 parent b294821 commit 8704b84
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 1 deletion.
7 changes: 7 additions & 0 deletions SharpDevelop.Tests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelop", "src\Main\Sh
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker120", "src\Main\ICSharpCode.SharpDevelop.BuildWorker120\ICSharpCode.SharpDevelop.BuildWorker120.csproj", "{6F273DA5-E10C-45A6-9071-7313ECD98C90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker140", "src\Main\ICSharpCode.SharpDevelop.BuildWorker140\ICSharpCode.SharpDevelop.BuildWorker140.csproj", "{7BA66A6B-1ED8-4B4C-970C-8928E891418B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
Expand Down Expand Up @@ -290,6 +292,10 @@ Global
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Release|Any CPU.Build.0 = Release|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Release|Any CPU.Build.0 = Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
Expand Down Expand Up @@ -666,6 +672,7 @@ Global
{8035765F-D51F-4A0C-A746-2FD100E19419} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{6F273DA5-E10C-45A6-9071-7313ECD98C90} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{7BA66A6B-1ED8-4B4C-970C-8928E891418B} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6222A3A1-83CE-47A3-A4E4-A018F82D44D8} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
Expand Down
7 changes: 7 additions & 0 deletions SharpDevelop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelop", "src\Main\Sh
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker120", "src\Main\ICSharpCode.SharpDevelop.BuildWorker120\ICSharpCode.SharpDevelop.BuildWorker120.csproj", "{6F273DA5-E10C-45A6-9071-7313ECD98C90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker140", "src\Main\ICSharpCode.SharpDevelop.BuildWorker140\ICSharpCode.SharpDevelop.BuildWorker140.csproj", "{7BA66A6B-1ED8-4B4C-970C-8928E891418B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
Expand Down Expand Up @@ -237,6 +239,10 @@ Global
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F273DA5-E10C-45A6-9071-7313ECD98C90}.Release|Any CPU.Build.0 = Release|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BA66A6B-1ED8-4B4C-970C-8928E891418B}.Release|Any CPU.Build.0 = Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
Expand Down Expand Up @@ -527,6 +533,7 @@ Global
{8035765F-D51F-4A0C-A746-2FD100E19419} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{6F273DA5-E10C-45A6-9071-7313ECD98C90} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{7BA66A6B-1ED8-4B4C-970C-8928E891418B} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01}
{D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
Expand Down
11 changes: 11 additions & 0 deletions src/Main/Base/Project/Util/DotnetDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,16 @@ public static bool IsBuildTools2013Installed()
return key != null && key.GetValue("Install") as int? >= 1;
}
}

/// <summary>
/// Gets whether the Microsoft Build Tools 2015 (MSBuild 14.0) is installed.
/// </summary>
public static bool IsBuildTools2015Installed()
{
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\BuildTools\Servicing\14.0
using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\DevDiv\BuildTools\Servicing\14.0\MSBuild")) {
return key != null && key.GetValue("Install") as int? >= 1;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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.Reflection;

[assembly: AssemblyTitle("SharpDevelop Build Worker for MSBuild 14.0")]
[assembly: AssemblyDescription("Runs MSBuild 14.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<ProjectGuid>{7BA66A6B-1ED8-4B4C-970C-8928E891418B}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<RootNamespace>ICSharpCode.SharpDevelop.BuildWorker</RootNamespace>
<AssemblyName>ICSharpCode.SharpDevelop.BuildWorker140</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<OutputPath>..\..\..\bin\</OutputPath>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Globalization#CA1303</CodeAnalysisRules>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<NoWin32Manifest>False</NoWin32Manifest>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<Prefer32Bit>True</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\BuildJob.cs">
<Link>BuildJob.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\EventSource.cs">
<Link>EventSource.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\EventTypes.cs">
<Link>EventTypes.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\ExtendedBinaryReader.cs">
<Link>ExtendedBinaryReader.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\HostProcess.cs">
<Link>HostProcess.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\MSBuild40.cs">
<Link>MSBuild40.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\Program.cs">
<Link>Program.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions src/Main/ICSharpCode.SharpDevelop.BuildWorker140/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- Microsoft.Build.Engine instead of Microsoft.Build here because a task run under Microsoft.Build may load Microsoft.Build.Engine, which will attempt to read this section. -->
<section name="msbuildToolsets" type="Microsoft.Build.BuildEngine.ToolsetConfigurationSection, Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<runtime>
<DisableFXClosureWalk enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- redirect MSBuild.Framework requests to make old task assemblies work with MSBuild 12.0 -->
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CompactFramework.Build.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="9.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sealed class BuildWorkerManager
readonly List<BuildWorker> freeWorkers = new List<BuildWorker>();
readonly string workerProcessName;

public static readonly BuildWorkerManager MSBuild140 = new BuildWorkerManager("ICSharpCode.SharpDevelop.BuildWorker140.exe");
public static readonly BuildWorkerManager MSBuild120 = new BuildWorkerManager("ICSharpCode.SharpDevelop.BuildWorker120.exe");
public static readonly BuildWorkerManager MSBuild40 = new BuildWorkerManager("ICSharpCode.SharpDevelop.BuildWorker40.exe");
public static readonly BuildWorkerManager MSBuild35 = new BuildWorkerManager("ICSharpCode.SharpDevelop.BuildWorker35.exe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ internal Task<bool> RunBuildAsync(CancellationToken cancellationToken)
tcs.SetResult(false);
}
} else {
if (DotnetDetection.IsBuildTools2013Installed()) {
if (DotnetDetection.IsBuildTools2015Installed()) {
BuildWorkerManager.MSBuild140.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
} else if (DotnetDetection.IsBuildTools2013Installed()) {
BuildWorkerManager.MSBuild120.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
} else {
BuildWorkerManager.MSBuild40.RunBuildJob(job, loggerChain, OnDone, cancellationToken);
Expand Down

0 comments on commit 8704b84

Please sign in to comment.