Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package Microsoft.AspNetCore.Components.WebAssembly 5.0.0 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1)

I created a hosted WASM Blazor app using the Blazor client template in Visual Studio. I am trying to upgrade the Microsoft.AspNetCore.Components.WebAssembly package in the Client project from 3.2.1 to 5.0. I get this error:

Package Microsoft.AspNetCore.Components.WebAssembly 5.0.0 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1). Package Microsoft.AspNetCore.Components.WebAssembly 5.0.0 supports: net5.0 (.NETCoreApp,Version=v5.0) BlazorApp1.Client

The client project is targeting .NET Standard 2.1. I am not clear about the difference between targeting .NET standard and targeting .Net Core. I thought .NET Core 5.0 implements all of .NET Standard 2.1. Only .NET Standard target options are available.

How does one upgrade that package?

Also, there's no version 5.0 of Microsoft.AspNetCore.Components.WebAssembly.Build. Did the package get obsoleted?

like image 418
Tony_Henrich Avatar asked Oct 30 '25 03:10

Tony_Henrich


1 Answers

Although you can reference netstandard2.1 packages in a .NET5 application (targeting net5.0), to upgrade your Blazor app to 5.0.0 (.NET5) you also have to change target framework to net5.0 since it depends on it, as you have noticed.

But other than this, there are more changes to be made to get it fully upgraded. The MS Docs on how to Migrate from ASP.NET Core 3.1 to 5.0 (as Brian already pointed out) should help get the job done.

like image 82
Michel Jansson Avatar answered Nov 01 '25 12:11

Michel Jansson