Skip to content

Commit b6c1689

Browse files
committed
Use build Wasm Runtime tasks when available
1 parent e75b601 commit b6c1689

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ Copyright (c) .NET Foundation. All rights reserved.
7575
<!-- Internal properties -->
7676
<_BlazorOutputPath>wwwroot\_framework\</_BlazorOutputPath>
7777

78-
<!-- Properties for AOT -->
7978
<MicrosoftNetCoreAppRuntimePackRidDir>$(NuGetPackageRoot)microsoft.netcore.app.runtime.mono.browser-wasm\$(BundledNETCoreAppPackageVersion)\runtimes\browser-wasm\</MicrosoftNetCoreAppRuntimePackRidDir>
80-
<AOTMode>AotInterp</AOTMode>
81-
<WasmStripAOTAssemblies>false</WasmStripAOTAssemblies>
82-
<WasmGenerateAppBundle>false</WasmGenerateAppBundle>
8379

8480
<_TargetingNET60OrLater Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))">true</_TargetingNET60OrLater>
8581
</PropertyGroup>
@@ -567,36 +563,36 @@ Copyright (c) .NET Foundation. All rights reserved.
567563
</Target>
568564

569565
<Target
570-
Name="_BlazorWasmAOT"
571-
DependsOnTargets="_EnsureWasmAOTWorkload;_GatherWasmFilesToAOT;WasmBuildApp"
566+
Name="_BlazorWasmNative"
567+
DependsOnTargets="_EnsureWasmRuntimeWorkload;_GatherWasmFilesToBuild;WasmBuildApp"
572568
BeforeTargets="_ProcessPublishFilesForBlazor"
573-
Condition="'$(RunAOTCompilation)' == 'true'">
569+
Condition="'$(UsingBrowserRuntimeWorkload)' == 'true'">
574570

575571
<!--
576-
AOT compilation produces a copy of the dotnet.js and dotnet.wasm file that are required to run the app. Replace the regular js and wams files with the AOTed version.
577-
But first, mangle the AOTed dotnet.js file to include the runtime version.
572+
Native compilation produces a copy of the dotnet.js and dotnet.wasm file that are required to run the app. Replace the regular js and wams files with the AOTed version.
573+
But first, mangle the new dotnet.js file to include the runtime version.
578574
-->
579575

580576
<Copy SourceFiles="@(WasmNativeAsset)" DestinationFiles="%(RootDir)%(Directory)\dotnet.$(_DotNetJsVersion).js" Condition="%(FileName) == 'dotnet' AND %(Extension) == '.js'">
581-
<Output TaskParameter="CopiedFiles" ItemName="_PublishAotDotnetJsFile" />
577+
<Output TaskParameter="CopiedFiles" ItemName="_PublishNativeDotnetJsFile" />
582578
</Copy>
583579

584580
<ItemGroup>
585-
<ResolvedFileToPublish Remove="$(_BlazorDotNetJSFilePath)" />
586-
<ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="%(FileName) == 'dotnet' AND %(Extension) == '.wasm'" />
581+
<ResolvedFileToPublish Remove="$(_BlazorDotNetJSFilePath)" Condition="'@(WasmNativeAsset->Count())' != '0'"/>
582+
<ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="(%(FileName) == 'dotnet' AND %(Extension) == '.wasm') AND '@(WasmNativeAsset->Count())' != '0'" />
587583

588-
<ResolvedFileToPublish Include="@(_PublishAotDotnetJsFile)" AssetType="native" RelativePath="%(FileName)%(Extension)" />
584+
<ResolvedFileToPublish Include="@(_PublishNativeDotnetJsFile)" AssetType="native" RelativePath="%(FileName)%(Extension)" />
589585
<ResolvedFileToPublish Include="@(WasmNativeAsset)" AssetType="native" RelativePath="dotnet.wasm" Condition="%(FileName) == 'dotnet' AND %(Extension) == '.wasm'"/>
590586
</ItemGroup>
591587
</Target>
592588

593-
<Target Name="_EnsureWasmAOTWorkload" Condition="'$(UsingBlazorAOTWorkloadManifest)' != 'true'">
589+
<Target Name="_EnsureWasmRuntimeWorkload" Condition="'$(UsingBlazorAOTWorkloadManifest)' != 'true'">
594590
<Error
595591
Text="Publishing with AOT enabled requires the .NET WebAssembly AOT workload to be installed. To learn more, visit https://aka.ms/AAb4uzl."
596592
Code="BLAZORSDK1002" />
597593
</Target>
598594

599-
<Target Name="_GatherWasmFilesToAOT">
595+
<Target Name="_GatherWasmFilesToBuild">
600596
<ItemGroup>
601597
<WasmAssembliesToBundle Include="%(ResolvedFileToPublish.FullPath)" Exclude="@(_Exclude)" Condition="%(Extension) == '.dll' AND %(FileName) != 'Microsoft.JSInterop.WebAssembly'" />
602598
</ItemGroup>

0 commit comments

Comments
 (0)