Marin
Marin

Reputation: 12920

How do I rename a Blazor WASM project?

I renamed sln, csproj and namespace but am getting these three errors which I didn't have prior to renaming.

   /App.razor(66,66): Error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?) (CS0246) 
  /obj/Debug/net5.0/Razor/App.razor.g.cs(155,155): Error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type (CS1662)
   /App.razor(37,37): Error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?) (CS0246) 

Upvotes: 2

Views: 1453

Answers (2)

BCA
BCA

Reputation: 8516

I had the same problem until I renamed the namespace to match the project name

Upvotes: 0

James Heffer
James Heffer

Reputation: 752

You could create a project template from within Visual Studio

enter image description here

This will let you "re-create" your project with a new name, it will keep everything you have but rename some namespaces to your new name.

Also helpful if you need to create "project templates" to be re-used in your organization

Upvotes: 2

Related Questions