帮助解决无法访问的嵌入式资源问题
有两个程序的代码非常相似,目的相同,它们的功能之一是启动 winform。
它们之间的主要区别在于,一个是“针对”.NET 3.5(因此使用 3.5 方法/约定),另一个是 .NET 4.0 项目(使用较新的方法执行相同的操作)
3.5 项目可以正常启动 winform ,但 4.0 项目报告找不到嵌入表单 .resx 文件中的图标“$this.Icon”。
3.5 和 4.0 之间是否存在可能导致此问题的关键差异?也许 4.0 对命名约定更严格并且不喜欢美元符号?
我已将调用表单的代码文件从 3.5 导入到我的 4.0 项目中,但仍然抛出文件未找到错误:(
错误消息:无法加载文件或程序集“Olympic.Braindump.OutlookPlugin2010.resources,版本=1.0”。 0.0, Culture=en-US, PublicKeyToken=null' 或其依赖项之一
:at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence)。 assemblySecurity、RuntimeAssembly locationHint、StackCrawlMark&stackMark、布尔型 throwOnFileNotFound、布尔型内省、布尔型抑制安全检查) 在 System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(字符串名称、CultureInfo 区域性、Version 版本、布尔值 throwOnFileNotFound、StackCrawlMark& stackMark) 在 System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo LookForCulture、StackCrawlMark& stackMark) 在System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo文化,字典
2 localResourceSets,布尔tryParents,布尔createIfNotExists,StackCrawlMark&stackMark)
There are two programs that are very similar in code for the same purpose, and one of their functions is launching a winform.
The main difference between them is that one is 'targetted' to .NET 3.5 (and so uses 3.5 methods/conventions) and the other is a .NET 4.0 project (does same thing with newer methods)
the 3.5 project can launch the winform fine, but the 4.0 project reports that the icon '$this.Icon' embedded within the form's .resx file cannot be found.
Is there a key difference between 3.5 and 4.0 that could be causing this? Maybe 4.0 is stricter about naming conventions and doesn't like the dollar sign?
I've imported the code file that calls the form from 3.5 to my 4.0 project and that still throws a file not found error :(
error message : Could not load file or assembly 'Olympic.Braindump.OutlookPlugin2010.resources, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
part of the stacktrace : at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论