Skip to content

Commit a061cfe

Browse files
committed
Use build Wasm Runtime tasks when available
1 parent 43c12fe commit a061cfe

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

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

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ Copyright (c) .NET Foundation. All rights reserved.
7474

7575
<!-- Internal properties -->
7676
<_BlazorOutputPath>wwwroot\_framework\</_BlazorOutputPath>
77-
78-
<!-- Properties for AOT -->
79-
<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>
83-
8477
<_TargetingNET60OrLater Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))">true</_TargetingNET60OrLater>
8578
</PropertyGroup>
8679

@@ -567,36 +560,36 @@ Copyright (c) .NET Foundation. All rights reserved.
567560
</Target>
568561

569562
<Target
570-
Name="_BlazorWasmAOT"
571-
DependsOnTargets="_EnsureWasmAOTWorkload;_GatherWasmFilesToAOT;WasmBuildApp"
563+
Name="_BlazorWasmNative"
564+
DependsOnTargets="_EnsureWasmRuntimeWorkload;_GatherWasmFilesToBuild;WasmBuildApp"
572565
BeforeTargets="_ProcessPublishFilesForBlazor"
573-
Condition="'$(RunAOTCompilation)' == 'true'">
566+
Condition="'$(UsingBrowserRuntimeWorkload)' == 'true'">
574567

575568
<!--
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.
569+
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.
570+
But first, mangle the new dotnet.js file to include the runtime version.
578571
-->
579572

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

584577
<ItemGroup>
585-
<ResolvedFileToPublish Remove="$(_BlazorDotNetJSFilePath)" />
586-
<ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="%(FileName) == 'dotnet' AND %(Extension) == '.wasm'" />
578+
<ResolvedFileToPublish Remove="$(_BlazorDotNetJSFilePath)" Condition="'@(WasmNativeAsset->Count())' != '0'"/>
579+
<ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" Condition="(%(FileName) == 'dotnet' AND %(Extension) == '.wasm') AND '@(WasmNativeAsset->Count())' != '0'" />
587580

588-
<ResolvedFileToPublish Include="@(_PublishAotDotnetJsFile)" AssetType="native" RelativePath="%(FileName)%(Extension)" />
581+
<ResolvedFileToPublish Include="@(_PublishNativeDotnetJsFile)" AssetType="native" RelativePath="%(FileName)%(Extension)" />
589582
<ResolvedFileToPublish Include="@(WasmNativeAsset)" AssetType="native" RelativePath="dotnet.wasm" Condition="%(FileName) == 'dotnet' AND %(Extension) == '.wasm'"/>
590583
</ItemGroup>
591584
</Target>
592585

593-
<Target Name="_EnsureWasmAOTWorkload" Condition="'$(UsingBlazorAOTWorkloadManifest)' != 'true'">
586+
<Target Name="_EnsureWasmRuntimeWorkload" Condition="'$(UsingBlazorAOTWorkloadManifest)' != 'true'">
594587
<Error
595588
Text="Publishing with AOT enabled requires the .NET WebAssembly AOT workload to be installed. To learn more, visit https://aka.ms/AAb4uzl."
596589
Code="BLAZORSDK1002" />
597590
</Target>
598591

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

0 commit comments

Comments
 (0)