将图像添加到 ImageList 后出现编译错误 RG0000(“格式不正确”)
在我正在处理的项目中,有一个包含 ImageList 控件的特定表单。直到几天前,一切都工作正常,并且控件中有 5 张图像。
然后我的一位同事向控件添加了第六张图像。我从源代码管理中获取了最新版本,突然我的项目无法再编译。错误信息:
错误 RG0000:无法加载文件或程序集“file:///D:/MyProjectPath/Bin/Debug/SomeOther.dll”或其依赖项之一。尝试加载格式不正确的程序。
该错误消息显然是伪造的。 ImageList 控件和 SomeOther.dll
之间没有任何联系。当我恢复同事所做的更改时,该项目再次编译正常。但如果我尝试删除他添加的一张图像,它仍然会给出编译器错误。事实上,如果我删除所有图像,然后自己添加一个新图像,它仍然会引发错误。只有当我从 ImageList 中删除所有图像时,它才会编译!
这里确实有些不太酷。总结一下:
- 源代码管理中的旧代码编译得很好,ImageControl 中有 5 个图像。
- 如果任何人(包括我自己)添加新图像,它就不会编译。
- 即使删除新映像后,该项目也无法编译。 resx 文件之间的文件差异显示整个长“imageList.ImageStream”加密字符串中的一两个字符已更改。在这些字符恢复为其旧值之前,该项目不会重新编译。
- 这个问题只存在于我的开发环境中。其他所有开发人员都没有任何问题。
有什么想法吗?
In the project I'm working on, there is a certain form that contains an ImageList control. Up until a few days ago, everything was working fine, and there were 5 images in the control.
Then one of my co-workers added a 6th image to the control. I got latest version from source control, and suddenly my project would not compile anymore. Error message:
error RG0000: Could not load file or assembly 'file:///D:/MyProjectPath/Bin/Debug/SomeOther.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
This error message is obviously bogus. There is no connection whatsoever between the ImageList control and SomeOther.dll
. When I reverted the changes my colleague made, the project compiled fine again. But if I tried just to remove the one image he added, it still gives the compiler error. In fact, if I remove all the images, then add a new one myself, it still throws the error. Only if I remove all images from the ImageList will it compile!
Something is really not cool here. To summarize:
- The old code in source control compiles fine, with 5 images in the ImageControl.
- If anyone (myself included) adds a new image, it doesn't compile.
- Even after removing the new image, the project does not compile. A file diff between the resx files reveals that one or two characters in the whole long "imageList.ImageStream" encrypted string have been changed. The project does not recompile until those characters have been reverted to their old value.
- This problem only exists in my dev environment. Every other developer has no trouble at all.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处找到了解决方案。自 2010 年 5 月以来,这是 Microsoft 的一个已知错误,但他们仍未发布补丁。必须使用那里建议的解决方法。多么痛苦!
Solution found here. It's a known bug at Microsoft since may 2010, and they have still not released a patch. Have to use the workaround suggested there. What a PAIN!