Sajjad Arash
Sajjad Arash

Reputation: 349

Blazor error Type or namespace name 'App' could not be found

I have migrate project from .NET 6 to .NET 7 preview 2, and now I have this output:

 error CS0246: The type or namespace name 'App' could not be found 

I am using Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.2.0 Preview 2.1.

Upvotes: 1

Views: 3921

Answers (2)

Raffy
Raffy

Reputation: 605

Go to your Program.cs and check if this line displays an error.

builder.RootComponents.Add<App>("#app");

If you're using Visual Studio, go to that line and hit Alt + Enter to show the code suggestions. Check if it asks you to import the root namespace of your project. Example: if your project is named MyProject you might need to add using Myproject at the import section of the Program.cs file.

Upvotes: 1

fixmeinfortyfive
fixmeinfortyfive

Reputation: 111

Double check all installed nuget packages are also updated to the appropriate preview version that is compatible with .NET 7

Upvotes: 0

Related Questions