-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
182 lines (148 loc) · 9.47 KB
/
Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!--
***********************************************************************************************
Microsoft.NET.Sdk.BlazorWebAssembly.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project ToolsVersion="14.0">
<PropertyGroup>
<EnableDefaultContentItems Condition=" '$(EnableDefaultContentItems)' == '' ">true</EnableDefaultContentItems>
<!-- Trimmer defaults that depend on user-definable settings.
This must be configured before it's initialized in the .NET SDK targets (which are imported by the Razor SDK). -->
<SuppressTrimAnalysisWarnings Condition="'$(SuppressTrimAnalysisWarnings)' == '' And '$(TrimmerDefaultAction)' != 'link'">true</SuppressTrimAnalysisWarnings>
<!-- Must happen before WasmSDK import -->
<WasmNestedPublishAppDependsOn>_GatherBlazorFilesToPublish;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn>
</PropertyGroup>
<Import Sdk="Microsoft.NET.Sdk.WebAssembly" Project="Sdk.targets" />
<PropertyGroup>
<!-- Paths to tools, tasks, and extensions are calculated relative to the BlazorWebAssemblySdkDirectoryRoot. This can be modified to test a local build. -->
<BlazorWebAssemblySdkDirectoryRoot Condition="'$(BlazorWebAssemblySdkDirectoryRoot)'==''">$(MSBuildThisFileDirectory)..\</BlazorWebAssemblySdkDirectoryRoot>
<_BlazorWebAssemblySdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">net10.0</_BlazorWebAssemblySdkTasksTFM>
<_BlazorWebAssemblySdkTasksTFM Condition=" '$(MSBuildRuntimeType)' != 'Core'">net472</_BlazorWebAssemblySdkTasksTFM>
<_BlazorWebAssemblySdkTasksAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tools\$(_BlazorWebAssemblySdkTasksTFM)\Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.dll</_BlazorWebAssemblySdkTasksAssembly>
<_BlazorWebAssemblySdkToolAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tools\net10.0\Microsoft.NET.Sdk.BlazorWebAssembly.Tool.dll</_BlazorWebAssemblySdkToolAssembly>
</PropertyGroup>
<UsingTask TaskName="Microsoft.NET.Sdk.BlazorWebAssembly.CreateBlazorTrimmerRootDescriptorFile" AssemblyFile="$(_BlazorWebAssemblySdkTasksAssembly)" />
<UsingTask TaskName="Microsoft.NET.Sdk.BlazorWebAssembly.GenerateBlazorBootExtensionJson" AssemblyFile="$(_BlazorWebAssemblySdkTasksAssembly)" />
<PropertyGroup>
<SelfContained>true</SelfContained>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Runtime feature defaults to trim unnecessary code -->
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">true</UseSystemResourceKeys>
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' != 'Debug'">false</DebuggerSupport>
<BlazorCacheBootResources Condition="'$(BlazorCacheBootResources)' == ''">true</BlazorCacheBootResources>
<_TargetingNET80OrLater>$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))</_TargetingNET80OrLater>
<WasmFingerprintDotnetJs>true</WasmFingerprintDotnetJs>
<WasmFingerprintDotnetJs Condition="'$(_TargetingNET80OrLater)' == 'true'">false</WasmFingerprintDotnetJs>
<WasmEnableWebcil Condition="'$(WasmEnableWebcil)' == '' and ('$(TargetFrameworkIdentifier)' != '.NETCoreApp' or '$(_TargetingNET80OrLater)' != 'true')">false</WasmEnableWebcil>
<!-- Turn off parts of the build that do not apply to Blazor projects -->
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
<!-- Don't generate a NETSDK1151 error if a non self-contained Exe references a Blazor Exe -->
<ShouldBeValidatedAsExecutableReference>false</ShouldBeValidatedAsExecutableReference>
<DisableAutoWasmBuildApp>true</DisableAutoWasmBuildApp>
<DisableAutoWasmPublishApp>true</DisableAutoWasmPublishApp>
</PropertyGroup>
<!-- Wire-up static web assets -->
<PropertyGroup>
<ResolveBuildRelatedStaticWebAssetsDependsOn>
$(ResolveBuildRelatedStaticWebAssetsDependsOn);
_ResolveBlazorWasmOutputs;
</ResolveBuildRelatedStaticWebAssetsDependsOn>
<GenerateBuildWasmBootJsonDependsOn>
$(GenerateBuildWasmBootJsonDependsOn);
GenerateBuildBlazorBootExtensionJson;
</GenerateBuildWasmBootJsonDependsOn>
<GeneratePublishWasmBootJsonDependsOn>
$(GeneratePublishWasmBootJsonDependsOn);
GeneratePublishBlazorBootExtensionJson;
</GeneratePublishWasmBootJsonDependsOn>
</PropertyGroup>
<Target Name="_BlazorWasmNativeForBuild" DependsOnTargets="_GatherBlazorFilesToBuild;WasmBuildApp" Condition="'$(UsingBrowserRuntimeWorkload)' == 'true'" />
<Target Name="_GatherBlazorFilesToBuild">
<ItemGroup>
<WasmAssembliesToBundle Condition="'%(WasmAssembliesToBundle.FileName)' == 'Microsoft.JSInterop.WebAssembly'" AOT_InternalForceToInterpret="true" />
</ItemGroup>
</Target>
<Target Name="_ResolveBlazorWasmOutputs" DependsOnTargets="ResolveWasmOutputs;ResolveReferences;PrepareResourceNames;ComputeIntermediateSatelliteAssemblies;_BlazorWasmNativeForBuild" BeforeTargets="_RazorPrepareForRun">
<ItemGroup>
<_BlazorJSFile Include="$(BlazorWebAssemblyJSPath)" />
<_BlazorJSFile Include="$(BlazorWebAssemblyJSMapPath)" Condition="Exists('$(BlazorWebAssemblyJSMapPath)')" />
<_BlazorJsFile>
<RelativePath>_framework/%(Filename)%(Extension)</RelativePath>
</_BlazorJsFile>
<!-- A missing blazor.webassembly.js is our packaging error. Produce an error so it's discovered early. -->
<Error
Text="Unable to find BlazorWebAssembly JS files. This usually indicates a packaging error."
Code="RAZORSDK1007"
Condition="'@(_BlazorJSFile->Count())' == '0'" />
</ItemGroup>
<DefineStaticWebAssets
CandidateAssets="@(_BlazorJSFile)"
SourceId="$(PackageId)"
SourceType="Computed"
AssetKind="All"
AssetMergeSource="$(StaticWebAssetMergeTarget)"
AssetRole="Primary"
AssetTraitName="WasmResource"
AssetTraitValue="boot"
CopyToOutputDirectory="PreserveNewest"
CopyToPublishDirectory="PreserveNewest"
ContentRoot="$(OutputPath)wwwroot"
BasePath="$(StaticWebAssetBasePath)"
>
<Output TaskParameter="Assets" ItemName="_BlazorJSStaticWebAsset" />
</DefineStaticWebAssets>
<DefineStaticWebAssetEndpoints
CandidateAssets="@(_BlazorJSStaticWebAsset)"
ExistingEndpoints="@(StaticWebAssetEndpoint)"
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)"
>
<Output TaskParameter="Endpoints" ItemName="_BlazorStaticWebAssetEndpoint" />
</DefineStaticWebAssetEndpoints>
<ItemGroup>
<StaticWebAsset Include="@(_BlazorJSStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(_BlazorStaticWebAssetEndpoint)" />
</ItemGroup>
</Target>
<!-- Just print a message here, static web assets takes care of all the copying -->
<Target Name="_BlazorCopyFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory">
<Message Importance="High" Text="$(MSBuildProjectName) (Blazor output) -> $(TargetDir)wwwroot" Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)'!='true'" />
</Target>
<!-- Make sure that ResolveAssemblyReferences runs early enough to ensure satellite assemblies are populated in the ResolvedFilesToPublish -->
<Target Name="_BlazorPrepareForPublish"
DependsOnTargets="PrepareResourceNames;ComputeIntermediateSatelliteAssemblies;ResolveAssemblyReferences"
BeforeTargets="PrepareForPublish" />
<Target Name="_GatherBlazorFilesToPublish">
<ItemGroup>
<WasmAssembliesToBundle Condition="'%(WasmAssembliesToBundle.FileName)' == 'Microsoft.JSInterop.WebAssembly'" AOT_InternalForceToInterpret="true" />
</ItemGroup>
</Target>
<Target Name="GenerateBuildBlazorBootExtensionJson">
<PropertyGroup>
<_BlazorBuildBootExtensionJsonPath>$(IntermediateOutputPath)blazor.build.boot-extension.json</_BlazorBuildBootExtensionJsonPath>
</PropertyGroup>
<GenerateBlazorBootExtensionJson OutputPath="$(_BlazorBuildBootExtensionJsonPath)" />
<ItemGroup>
<FileWrites Include="$(_BlazorBuildBootExtensionJsonPath)" />
<WasmBootConfigExtension Include="$(_BlazorBuildBootExtensionJsonPath)" Key="blazor" />
</ItemGroup>
</Target>
<Target Name="GeneratePublishBlazorBootExtensionJson">
<PropertyGroup>
<_BlazorPublishBootExtensionJsonPath>$(IntermediateOutputPath)blazor.publish.boot-extension.json</_BlazorPublishBootExtensionJsonPath>
</PropertyGroup>
<GenerateBlazorBootExtensionJson OutputPath="$(_BlazorPublishBootExtensionJsonPath)" />
<ItemGroup>
<FileWrites Include="$(_BlazorPublishBootExtensionJsonPath)" />
<WasmBootConfigExtension Remove="@(WasmBootConfigExtension)" Condition="'%(Key)' == 'blazor'" />
<WasmBootConfigExtension Include="$(_BlazorPublishBootExtensionJsonPath)" Key="blazor" />
</ItemGroup>
</Target>
</Project>