Reputation: 85
When publishing blazor webassembly project to an azure app service, I get the following error "C:\Program Files\dotnet\sdk\7.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.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: obj\publish\browser-wasm\project.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."
Upvotes: 1
Views: 2434
Reputation: 65
Looks like it happens with VS 17.7.6 and not with previous versions.
First i tried with dotnet workload install wasm-tools
but id didn't work.
The I tried dotnet workload repair
and it worked only after I restarted my PC.
Hope it helps because I lost my saturday night after it.
Upvotes: 3
Reputation: 7317
I have deployed the Blazor WASM to Azure App Service without any issues.
My .csproj
file:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.12" PrivateAssets="all" />
</ItemGroup>
</Project>
To build this project, the following workloads must be installed: wasm-tools
Run dotnet workload install wasm-tools
command in CLI /Package Manage Console.
OR Install by Modifying the VS Installer.
Upvotes: 2