-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
46 lines (43 loc) · 2.53 KB
/
Directory.Build.targets
File metadata and controls
46 lines (43 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<Project>
<PropertyGroup>
<_TransformRoot Condition="'$(_TransformRoot)'==''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</_TransformRoot>
<_TransformOutputBase Condition="'$(_TransformOutputBase)'=='' and '$(dir-outputBase)'!=''">$(dir-outputBase)</_TransformOutputBase>
<_TransformOutputBase Condition="'$(_TransformOutputBase)'==''">$([System.IO.Path]::Combine('$(_TransformRoot)','Output','$(Configuration)'))\</_TransformOutputBase>
<_InstallerBuildProj>$([System.IO.Path]::Combine('$(_TransformRoot)','Build','InstallerBuild.proj'))</_InstallerBuildProj>
</PropertyGroup>
<!--
EnsureTransformsForManagedBuilds — guarantee XSL transform DLLs are up-to-date
before any managed project resolves assembly references.
We always invoke BuildWindowsXslAssemblies and let MSBuild's native
Inputs/Outputs incremental system decide whether recompilation is needed.
Previously this target gated on !Exists(), which meant a stale DLL (older
than source .xsl files) was never recompiled.
-->
<Target Name="EnsureTransformsForManagedBuilds"
BeforeTargets="ResolveAssemblyReferences"
Condition="!$([System.String]::IsNullOrEmpty('$(_TransformRoot)')) and '$(BuildingTransforms)'!='true' and '$(DesignTimeBuild)'!='true' and '$(OS)'=='Windows_NT' and $([System.IO.Path]::GetFullPath('$(MSBuildProjectFullPath)'))!='$(_InstallerBuildProj)'">
<MSBuild
Projects="$(_InstallerBuildProj)"
Targets="BuildWindowsXslAssemblies"
Properties="Configuration=$(Configuration);Platform=$(Platform);BuildingTransforms=true;dir-outputBase=$(_TransformOutputBase)"
Condition="Exists('$(_InstallerBuildProj)')" />
</Target>
<!--
WPF temp-file crash recovery:
If a build is interrupted between GenerateTemporaryTargetAssembly and
CleanupTemporaryTargetAssembly, stale *_wpftmp project files remain in the source
directory and break the next build. This target deletes them before Pass 2 runs.
-->
<Target Name="_CleanStaleWpfTempProjects"
BeforeTargets="MarkupCompilePass2ForMainAssembly"
Condition="'$(UseWPF)' == 'true' and '$(_IsWpfTempProject)' != 'true'">
<ItemGroup>
<_StaleWpfTemp Include="$(MSBuildProjectDirectory)\*_wpftmp*.csproj" />
<_StaleWpfTemp Include="$(MSBuildProjectDirectory)\*_wpftmp*.props" />
<_StaleWpfTemp Include="$(MSBuildProjectDirectory)\*_wpftmp*.targets" />
</ItemGroup>
<Delete Files="@(_StaleWpfTemp)" Condition="'@(_StaleWpfTemp)' != ''" />
<Message Text="Cleaned stale WPF temp files: @(_StaleWpfTemp)"
Condition="'@(_StaleWpfTemp)' != ''" Importance="normal" />
</Target>
</Project>