When creating a project with the Blazor template, I have the following error that is displayed:
NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.8.0-preview-19104-04 is not compatible with netcoreapp2.2 (.NETCoreApp,Version=v2.2). Package Microsoft.AspNetCore.Blazor.Cli 0.8.0-preview-19104-04 supports: netcoreapp3.0 (.NETCoreApp,Version=v3.0)
Steps to reproduce the behavior:
The application should run without error.
If I compile the project, I have the additional error:
Startup.cs(14,24,14,27): error CS0246: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
But it is surely related to the first error.
Similar to #7952
Executing the dotnet new -i Microsoft.AspNetCore.Blazor.Templates
console command solves the second error (compile), but it doesn't solve the first one (incompatible package)
If you recently installed VS2019 you will need to go into Tools / Options and search for ".NET Core". You will need to select the checkbox "Use Previews of the .NET Core SDK". Once you have done this, reload the solution and Build. It will pull down the necessary dependencies and build properly.
Thanks sbwalker, that solved this problem.
But Microsoft should really update the documentation, because these two problems are not obvious to solve.
This is still happening inVS 2019 v 16.00 Preview 4.1 SVC1. It was fine yesterday before I upgraded VS to SVC1.
Works for me when creating new projects. Projects created before checking the box are not fixed, but that's not a problem for me.
The "User previews of the .NET Core SDK" option has been relocated, it's under Environment > Preview Features. @sbwalker
(This made me loose my mind over the last hour)
Most helpful comment
If you recently installed VS2019 you will need to go into Tools / Options and search for ".NET Core". You will need to select the checkbox "Use Previews of the .NET Core SDK". Once you have done this, reload the solution and Build. It will pull down the necessary dependencies and build properly.