首页 > 解决方案 > 如何重命名 Blazor WASM 项目?

问题描述

我重命名了 sln、csproj 和命名空间,但出现了这三个我在重命名之前没有的错误。

   /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) 

标签: c#visual-studio

解决方案


您可以从 Visual Studio 中创建项目模板

在此处输入图像描述

这将允许您使用新名称“重新创建”您的项目,它将保留您拥有的所有内容,但将一些命名空间重命名为您的新名称。

如果您需要创建“项目模板”以在您的组织中重复使用,这也很有帮助


推荐阅读