skip to Main Content

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


  1. I have deployed the Blazor WASM to Azure App Service without any issues.

    enter image description here

    enter image description here

    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>
    
    • Check for the updates in the Visual Studio 2022 17.7.5 and modify.

    To build this project, the following workloads must be installed: wasm-tools

    Run dotnet workload install wasm-tools command in CLI /Package Manage Console.

    enter image description here

    OR
    Install by Modifying the VS Installer.

    enter image description here

    enter image description here

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search