如何修复“命名空间x已经包含x的定义”错误?发生后转换为VS2010 [英] How to fix "namespace x already contains a definition for x" error? Happened after converting to VS2010
问题描述
具体来说,错误出现在 Resources.Designer.cs
中:
Specifically the error occurs in the Resources.Designer.cs
:
错误2命名空间'ModulusFE'已经包含'StockChartX'的定义Resources.Designer.cs 11 21 ModulusFE.StockChartX
Error 2 The namespace 'ModulusFE' already contains a definition for 'StockChartX' Resources.Designer.cs 11 21 ModulusFE.StockChartX
ve googled这个,我还是很困惑。有人知道我可以尝试什么吗?
I've googled this and am still quite confused. Does anyone know anything I might try?
我已经尝试重建和清理,以及重命名 Resources.Designer.cs
I have tried rebuilding and cleaning, as well as renaming the Resources.Designer.cs
file in hopes that it would rebuild, but no luck.
代码的顶部表示:
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.225
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
任何想法都会受到赞赏。
Any ideas whatsoever would be appreciated.
推荐答案
大约一年前我发生过这种情况,我不记得是什么根本原因,但有两件事你可以尝试:
I had this happen to me about a year ago and I don't remember exactly what the root cause was, but there are two things you might try:
- 如果是自动生成的文件(如Resources.Designer.cs所示),请尝试删除它并让VS重新生成它。
- 单独或与#1结合使用,在解决方案资源管理器中选择
显示所有文件
或在Windows资源管理器中打开解决方案文件夹 - 该文件的某个版本不知何故被排除在项目之外,并且是看不见到VS,但仍然让它生气...
- If it's an auto-generated file (as 'Resources.Designer.cs' tend to be), try deleting it and letting VS re-generate it.
- Either separately or in conjunction with #1, select
Show All Files
in the Solution Explorer or open the solution folder in Windows Explorer - it could be that a version of the file somehow got excluded from the project and is therefor 'invisible' to VS but still makes it angry...
这篇关于如何修复“命名空间x已经包含x的定义”错误?发生后转换为VS2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!