Blazor the type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)

To use Blazor you need to have VS2019 preview edition or enable preview features on VS2019 by checking

Tools -> Options -> Environment -> Preview Features -> Use previews of the .NET Core SDK

or on the older versions of VS2019

Tools -> Options -> Projects and Solutions -> .NET Core -> Use previews of the .NET Core SDK

checkbox, then reload the solution and build.


After migrating my .NET Core 3.1 application to .NET 5.0 I experienced the same problem. My application was working just fine but since I opened my App.razor file errors showed.

"the type or namespace name 'pageName' could not be found" and the pages show normally.

Fixed the problem with Tools -> Options -> Environment -> Preview Features -> Use previews of the .NET Core SDK. Restart of Visual Studio and reloading project was also needed.

Which is kind of weird since I just moved to .NET 5.0