c# - 无法将文件添加到解决方案 : "A file or folder with the name [name] already exists"

标签 c# visual-studio

当我尝试将任何 文件添加到我的项目时,出现此错误:

A file or folder with the name azazaz.cs already exists.

Please give a unique name to the item you are adding, or delete the existing item first.'

Visual Studio 最近没有更新。问题只出现在这一个项目中。它在其他计算机上正常工作。

到目前为止我尝试了什么:

  • 我尝试了许多不同的名称,检查了隐藏文件,并检查了文件夹位置。

  • 按照 AbhishekP 的建议删除存储库并重新下载(通过 GitHub)。

  • 按照 Srikanth 的建议删除了“AppData\Local”文件夹中的“ComponentModelCache”文件夹。

  • 检查错误消息中文件名的“.csproj”文件夹,但它不存在。

我真的无法重新开始并创建一个新项目。

最佳答案

删除下面提到的路径下的“ComponentModelCache”文件夹,然后重新启动 Visual Studio。对于我安装的 Visual Studio 2012,以下是路径。根据您的 Visual Studio 版本搜索。

“C:\Users\ic016028\AppData\Local\Microsoft\VisualStudio\11.0\”

关于c# - 无法将文件添加到解决方案 : "A file or folder with the name [name] already exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24566467/

相关文章:

c# - 读取复杂的 XML 属性

c# - 如何将变量连接到某些 <asp : . ./> 属性中?

c++ - 使用 curlpp 对 HTTP 服务器进行 GET 和 POST 调用

c# - "ReflectionOnlyAssemblyResolve event"的 Visual Studio 构建问题

c++ - 如何在 Visual Studio 中查找静态 c/c++ 库中的函数

c# - 从表单中读取字符串作为逐字字符串,\\显示而不是\

c# - WCF是否缓存存储过程

c# - 调整表单大小以及它如何影响动态创建的 ListView

visual-studio - 有没有办法在 Visual Studio 中显示整个解决方案的构建时间?

c# - SqlException ErrorCode 返回 -2146232060 而不是 26(找不到服务器实例)