Aspnetcore: The default Blazor template solution doesn't run

Created on 1 Mar 2019  路  7Comments  路  Source: dotnet/aspnetcore

Describe the bug

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)

To Reproduce

Steps to reproduce the behavior:

  1. Install Visual Studio 2019
  2. Install .NET Core 3.0 Preview 2 SDK (3.0.100-preview-010184)
  3. Install the latest Blazor Language Services extension from the Visual Studio Marketplace
  4. Run the console command to make the Blazor template available.
  5. Create a Blazor project.
  6. The error is displayed.

Expected behavior

The application should run without error.

Additional context

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.

area-mvc

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.

vs2019

All 7 comments

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.

vs2019

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)

Was this page helpful?
0 / 5 - 0 ratings