Open Closed

Blazor WebAssembly Template Bug #1766


User avatar
0
hillin created
  • ABP Framework version: v4.4.0
  • UI type: Blazor WebAssembly
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

New projects created with abp suite Blazor WebAssembly template does not compile:

C:\Program Files\dotnet\sdk\5.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(415,5): error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.browser-wasm was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'browser-wasm'.

Chaning the blazor project file as follows can make it compile.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <UseBlazorWebAssembly>true</UseBlazorWebAssembly>
  </PropertyGroup>
</Project>

2 Answer(s)
  • User Avatar
    0
    hillin created

    WIth the problem above fixed, the app can run now, but the blazor website does not work because the file /_framework/blazor.boot.json cannot be found (404). It seems this file was not generated at all at build time.

  • User Avatar
    0
    hillin created

    The problem is caused by the mismatch between the version of the Microsoft.AspNetCore.Components.WebAssembly and Microsoft.AspNetCore.Components.WebAssembly.DevServer packages referenced by the blazor project, and the version of the .NET SDK. In the ABP template, these packages are referenced with a wildcard version (5.0.*), so the latest matching version (5.0.9) was restored; but I didn't have .NET SDK 5.0.9 installed (my latest was 5.0.3). Installing .NET SDK 5.0.9 has fixed the problem.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38