Visual Studio中的类包含错误

时间:2016-01-31 19:33:32

标签: c# visual-studio visual-studio-2015 build-error

我目前正在视觉工作室开发基于文本的游戏。我与一个类有一个命名空间冲突 我有一个名为Clothing的类名和名称为Clothing的名称空间。为了解决这个问题,我重新命名了命名空间衣服而不是服装,然后所有的戏剧都开始了。每当我尝试构建时,我的csproj文件都没有更新文件夹中的命名空间引用,我得到以下错误。

[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Shirts\Shirt.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\ClothingEnum.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Cloaks\Cloak.cs'.
[Failure] Could not find file '...\src\Items\Equipment\Apparel\Clothing\Boots\JackBoot.cs'.
...

如果我查看这些目录,文件存在但是为空。实际文件位于... \ src \ Items \ Equipment \ Apparel \ 衣服 \ Boots ...并且它们包含在csproj文件中。但这些文件也在那里。

本质上我要问的是如何从csproj文件中删除这些未使用的引用/依赖项/它们是什么。

手动删除csproj文件中的xml引用只会导致我的项目加载失败。

1 个答案:

答案 0 :(得分:1)

我不明白为什么在重命名命名空间后重命名文件夹 - 在我看来,这是不必要的。

您可以使用“从项目中排除”从解决方案资源管理器中删除cs文件,然后使用“添加 - >现有项目”添加新文件