Search code examples
blazor-webassembly.net-8.0

(Classic) Blazor WebAssembly project in .NET 8


With the launch of .NET 8 and VS2022 updated, I'm quite lost of how can I create a mimic of the old .Net 7 Hosted Web Assembly project.

I don't need the new interactivity Blazor features, just the classic architecture, but running on .NET 8.


Solution

  • The new "Web App" template comes close. You can add Controllers and a Shared class library. But there is no PWA support.

    You can still use the old template from the command line:

     dotnet new blazorwasm --hosted --pwa
    

    that will then be .net 7 but you can edit the .csproj files (3x) to <TargetFramework>net8.0</TargetFramework> and the packages to 8.0.0

    The project/folder structure has changed here and there but that is largely cosmetic. You can make most of those changes manually.