我正在开发一个现有的 Windows 窗体应用程序。我只需要做一些修改,在这些更改期间,我遇到了一个场景,我也需要重命名现有的命名空间。现在重命名该命名空间后,我的项目没有运行。虽然它编译得很好但是在下面的代码行中断了
ImageList il = new ImageList();
ImageList = il;
il.Images.Add((Image)new Bitmap(GetType(), "Images.ImageFileName.png"));//when this line is executed a dialog box appears and says that "there is no source code available for current location"
现在,因为我是 .net 世界的新手,所以我研究了这个问题,并认为它是由于 namspace 的变化而产生的。我还尝试重命名 Resources.Designer.cs 中的命名空间 但也没有解决我的问题
最佳答案
谢谢大家
我自己找到了解决方案。在这里发布解决方案的目的是其他人可能会从中受益。 事实上,这是我的一种粗心,因为我忘记更改属性“默认命名空间”的值,此属性包含旧命名空间,这就是为什么我的资源文件总是指向旧命名空间
关于更改命名空间后 C# resx 文件不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6054618/