Fix build issues caused by DirectXTK NuGet package file locking

The way the DirectXTK NuGet packages are built depends on a custom MSBuild extension
task. This DLL gets copied to a temporary location at the start of the build, then
loaded into the MSBuild process. Two problems result:

- The DLL copy fails if multiple processes attempt to build different flavors of the
  same project using the package in parallel. (poor) solution is to disable parallel
  build only for the project that uses DirectXTK.

- As long as MSBuild remains alive, the DLL is locked, so subsequent operations such
  as git clean will fail. Solution is to specify the MSBuild switch (/nr) telling it not to
  keep around process instances for later reuse.
This commit is contained in:
Shawn Hargreaves 2015-04-24 12:07:11 -07:00
Родитель 12f546b3bd
Коммит b8fe814fe7
3 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -112,8 +112,9 @@ and commit only once when you're done.
If you have added new functionality please make sure to add tests to the
appropriate test suites.
To validate your changes, run "msbuild /m Win2D.proj" from a Visual Studio
command prompt. This will:
To validate your changes, run "msbuild /m /nr:false Win2D.proj" from a
Visual Studio command prompt (if using Visual Studio 2013) or MSBuild
command prompt (if using Visual Studio 2015). This will:
- Build all flavors of all projects (debug, release, x86, x64, and ARM)
- Run all automated tests

Просмотреть файл

@ -5,7 +5,7 @@
For best performance, enable parallel builds:
msbuild Win2D.proj /maxcpucount
msbuild Win2D.proj /maxcpucount /nr:false
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" DefaultTargets="Build">
@ -104,7 +104,9 @@
</WindowsProject>
<WindowsProject Include="tests\CoreWindowExample\Windows\CoreWindowExample.Windows.csproj" />
<WindowsProject Include="tests\CsConsumer\Windows\CsConsumer.Windows.csproj" />
<WindowsProject Include="tests\ExampleGallery\Direct3DInterop\Windows\ExampleGallery.Direct3DInterop.Windows.vcxproj" />
<WindowsProject Include="tests\ExampleGallery\Direct3DInterop\Windows\ExampleGallery.Direct3DInterop.Windows.vcxproj">
<BuildInParallel>false</BuildInParallel>
</WindowsProject>
<WindowsProject Include="tests\ExampleGallery\Windows\ExampleGallery.Windows.csproj" />
<WindowsProject Include="numerics\Cpp\tests\CppNumericsTests.Windows.vcxproj">
<AutomatedTests>store</AutomatedTests>
@ -124,7 +126,9 @@
<PhoneProject Include="winrt\test.managed\WindowsPhone\winrt.test.managed.WindowsPhone.csproj" />
<PhoneProject Include="tests\CoreWindowExample\WindowsPhone\CoreWindowExample.WindowsPhone.csproj" />
<PhoneProject Include="tests\CsConsumer\WindowsPhone\CsConsumer.WindowsPhone.csproj" />
<PhoneProject Include="tests\ExampleGallery\Direct3DInterop\WindowsPhone\ExampleGallery.Direct3DInterop.WindowsPhone.vcxproj" />
<PhoneProject Include="tests\ExampleGallery\Direct3DInterop\WindowsPhone\ExampleGallery.Direct3DInterop.WindowsPhone.vcxproj">
<BuildInParallel>false</BuildInParallel>
</PhoneProject>
<PhoneProject Include="tests\ExampleGallery\WindowsPhone\ExampleGallery.WindowsPhone.csproj"/>
<PhoneProject Include="numerics\Cpp\tests\CppNumericsTests.WindowsPhone.vcxproj" />
<PhoneProject Include="numerics\DotNet\tests\WindowsPhone\DotNetNumericsTests.WindowsPhone.csproj" />
@ -185,8 +189,8 @@
<Message Importance="High" Text="Building all variants of project %(ProjectsToBuild.PlatformIndependentName):" />
<Message Importance="High" Text=" %(ProjectsToBuild.Filename) (%(ProjectsToBuild.Configuration)|%(ProjectsToBuild.Platform))" />
<!-- All the variants (platform and configuration) of a project can be built in parallel -->
<MSBuild Projects="@(ProjectsToBuild)" BuildInParallel="true" Properties="IncludeVersionInfo=true" />
<!-- All the variants (platform and configuration) of most projects can be built in parallel -->
<MSBuild Projects="@(ProjectsToBuild)" BuildInParallel="%(ProjectsToBuild.BuildInParallel)" Properties="IncludeVersionInfo=true" />
</Target>
@ -214,6 +218,7 @@
<ProjectsToBuild Include="@(ProjectsPerConfig)">
<AdditionalProperties>Platform=%(ProjectsPerConfig.Platform);Configuration=%(ProjectsPerConfig.Configuration)</AdditionalProperties>
<PlatformIndependentName>$([System.String]::new('%(ProjectsPerConfig.Filename)').Replace('Windows', '').Replace('Phone', '').Replace('uap', '').TrimEnd('.'))</PlatformIndependentName>
<BuildInParallel Condition="'%(ProjectsPerConfig.BuildInParallel)' == ''">true</BuildInParallel>
</ProjectsToBuild>
</ItemGroup>
</Target>

Просмотреть файл

@ -38,7 +38,7 @@ IF "%NOUAP%" == "1" (
SET BUILD_UAP=/p:BuildUAP=false
)
msbuild "%~dp0Win2D.proj" /v:m /maxcpucount /p:BuildTests=false /p:BuildTools=false /p:BuildDocs=false %BUILD_UAP%
msbuild "%~dp0Win2D.proj" /v:m /maxcpucount /nr:false /p:BuildTests=false /p:BuildTools=false /p:BuildDocs=false %BUILD_UAP%
IF %ERRORLEVEL% NEQ 0 (
ECHO Build failed; aborting.