When publishing blazor webassembly project to an azure app service, I get the following error "C:Program Filesdotnetsdk7.0.402SdksMicrosoft.NET.SdktargetsMicrosoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools
To install these workloads, run the following command: dotnet workload restore".
I also checked use AOT and remove additional files at destination when publishing.
My API project publishes to the Azure App Service successfully, but not the blazor webassembly project.
I update my project via nuget. I use the latest version of visual studio (17.7.5).
The publish config is:
Config: Release
Target: .net 7.0
Mode: Self-contained
Runtime: browser-wasm
I ran the dotnet workload restore from the command line successfully. Deleted the bin and obj folders. Deleted publish profile and added it again. Rebuild the solution. It still fails to publish. It used to publish a while back. Not sure why it no longer publishes to Azure.
I also tried unchecking AOT and get the same error plus the below error:
objpublishbrowser-wasmproject.assets.json’ not found. Run a NuGet package restore to generate this file.
I ran dotnet restore and the result was "All projects are up-to-date for restore."
2
Answers
I have deployed the Blazor WASM to Azure App Service without any issues.
My
.csproj
file:Run
dotnet workload install wasm-tools
command in CLI /Package Manage Console.OR
Install by Modifying the VS Installer.
Looks like it happens with VS 17.7.6 and not with previous versions.
First i tried with
dotnet workaload install wasm-tools
but id didn’t work.The I tried
dotnet workaload repair
and it worked only after I restarted my PC.Hope it helps because I lost my saturday night after it.