locked
Compatibiliy problem with Blazor and .Net Core class library project reference RRS feed

  • Question

  • User-1417437217 posted

    Hello.

    I created a Blazor Webassembly app (3.1.0-preview3.19555.2) and added a reference to a .Net Core 3.0 Class Library project (my "Models" project).

    When I compile the Blazor app I get this error:

    error NU1201: Project Models is not compatible with netstandard2.1 (.NETStandard,Version=v2.1). Project Models supports: netcoreapp3.0 (.NETCoreApp,Version=v3.0)

    According to this (https://docs.microsoft.com/en-us/dotnet/standard/net-standard) I shouldn't be having this problem.

    Can anyone help?

    Thanks in advance,

    Mike

    Wednesday, November 27, 2019 3:38 AM

All replies

  • User-1780421697 posted

    Currently this happens in Visual Studio 2019 Preview but not on command line

    please have a look

    https://github.com/dotnet/cli/issues/11378

    Wednesday, November 27, 2019 4:42 AM
  • User-1417437217 posted

    Hi, Khuram. Thanks for responding.

    My problem is actually opposite: .Net Standard 2.1 referencing .Net Core 3.1.

    Does that make a difference? And what do you mean by "command line"? Do you mean "csc.exe"?

    Wednesday, November 27, 2019 11:47 AM
  • User-474980206 posted

    starting with .net standard  2.1, other frameworks can not be referenced (4.* or core). 

    if you are using blazor, you should use .net standard libraries to share code between blazor and server code. 

    Note: blazor webassembly  implements  its own .net runtime (based on the mono code), as all o/s calls (network, file, etc) must be done by calling JavaScript, many of the 2.0/2.1 api return not implemented. For example, while chrome and safari added experimental thread support to web assembly, it’s not yet in the blazor runtime. Blazor is single threaded.

    Saturday, November 30, 2019 10:03 PM