-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
79 lines (74 loc) · 4.9 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
79 lines (74 loc) · 4.9 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<Project>
<!--
Windows shipping graph: force x64 + win-x64 after the .csproj is evaluated
(TargetFramework and DisableUdtForceX64 are known here).
Fixes MSB3270 when VS builds with Platform=AnyCPU but references win-x64 assemblies.
-->
<PropertyGroup Condition="'$(DisableUdtForceX64)' != 'true' and '$(TargetFramework)' != '' and $([System.String]::Copy('$(TargetFramework)').Contains('windows'))">
<Platforms>x64</Platforms>
<Platform Condition="'$(Platform)' == '' or '$(Platform)' == 'AnyCPU' or '$(Platform)' == 'Any CPU'">x64</Platform>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
</PropertyGroup>
<!--
Portable CrossPlatform CLI/tests: keep host-native output (no win-x64 RID folder).
Critical for ubuntu/macOS CI smoke (`dotnet run`) and Apple Silicon test hosts.
-->
<PropertyGroup Condition="'$(DisableUdtForceX64)' == 'true'">
<RuntimeIdentifier></RuntimeIdentifier>
<RuntimeIdentifiers></RuntimeIdentifiers>
<SelfContained>false</SelfContained>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms Condition="'$(Platforms)' == '' or '$(Platforms)' == 'x64'">AnyCPU;x64</Platforms>
<Platform Condition="'$(Platform)' == '' or '$(Platform)' == 'x64'">AnyCPU</Platform>
<PlatformTarget Condition="'$(PlatformTarget)' == '' or '$(PlatformTarget)' == 'x64'">AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<!-- Desktop companion process: Workstation GC + DATAS + conserve-memory so the
self-contained Host returns unused heap to the OS instead of holding a
server-GC reservation. Applies to Host / CLI / NetworkProxy. -->
<PropertyGroup Condition="'$(IsUdtShippingApp)' == 'true'">
<ServerGarbageCollection>false</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<RetainVMGarbageCollection>false</RetainVMGarbageCollection>
<TieredCompilation>true</TieredCompilation>
<TieredPGO>true</TieredPGO>
</PropertyGroup>
<ItemGroup Condition="'$(IsUdtShippingApp)' == 'true'">
<RuntimeHostConfigurationOption Include="System.GC.ConserveMemory" Value="5" Trim="false" />
<RuntimeHostConfigurationOption Include="System.GC.DynamicAdaptationMode" Value="1" Trim="false" />
</ItemGroup>
<PropertyGroup Condition="'$(IsUdtShippingApp)' == 'true' and '$(Configuration)' == 'Release'">
<!-- Prefer size over local symbols; CI/Make already pass DebugType=None on publish. -->
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<CopyDebugSymbolFilesFromPackages>false</CopyDebugSymbolFilesFromPackages>
<PublishDocumentationFile>false</PublishDocumentationFile>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<DebuggerSupport>false</DebuggerSupport>
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
</PropertyGroup>
<Target Name="RejectShippingAppPublishWithTestHooks" BeforeTargets="BeforeBuild;SetGenerateManifests;PrepareForPublish">
<Error
Condition="'$(_IsPublishing)' == 'true' and '$(IsUdtShippingApp)' == 'true' and '$(EnableUdtTestHooks)' == 'true' and '$(AllowUdtTestHookPublish)' != 'true'"
Text="Shipping app publish cannot use EnableUdtTestHooks=true. Build the standalone test tools instead, or set AllowUdtTestHookPublish=true only for isolated non-shipping artifacts." />
</Target>
<!-- TraceEvent natives + orphan Crowdin satellites inflate shipping output. -->
<Target Name="PruneShippingAppFootprint"
AfterTargets="Publish"
Condition="'$(RuntimeIdentifier)' != '' and '$(IsUdtShippingApp)' == 'true' and '$(Configuration)' == 'Release' and '$(PublishDir)' != ''">
<PropertyGroup>
<_UdtPruneScript>$(MSBuildThisFileDirectory)Scripts\Prune-ShippingFootprint.ps1</_UdtPruneScript>
<_UdtPowerShellExecutable Condition="$([MSBuild]::IsOSPlatform('Windows'))">powershell</_UdtPowerShellExecutable>
<_UdtPowerShellExecutable Condition="!$([MSBuild]::IsOSPlatform('Windows'))">pwsh</_UdtPowerShellExecutable>
<!-- Trim trailing slash so PowerShell does not swallow the closing quote. -->
<_UdtPublishDirFull>$([System.String]::Copy($([System.IO.Path]::GetFullPath('$(PublishDir)'))).TrimEnd('\'))</_UdtPublishDirFull>
</PropertyGroup>
<Exec
Condition="Exists('$(_UdtPruneScript)') and Exists('$(_UdtPublishDirFull)')"
Command="$(_UdtPowerShellExecutable) -NoProfile -ExecutionPolicy Bypass -File "$(_UdtPruneScript)" -PayloadPath "$(_UdtPublishDirFull)" -RuntimeIdentifier "$(RuntimeIdentifier)" -AllowedCultures "$(UdtSatelliteResourceLanguages)"" />
</Target>
</Project>