.net 运行时尝试使用错误版本的程序集
我有一个引用程序集“Microsoft.Xna.Framework,Version=2.0.0.0,Culture=neutral,PublicKeyToken=6d5c3888ef60e27d”的应用程序。 我创建了一个安装程序项目,用于在 GAC 中安装该程序集(通过运行 XNA redist 安装程序)。
但是,当首次使用此程序集时,我在 JITing 期间收到异常。 然后我尝试 ngen 图像,ngen 给出以下错误消息:
Failed to load dependency Microsoft.Xna.Framework of assembly x,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null because of the following
error : The specified module could not be found. (Exception from HRESULT: 0x8007007E)
请注意,版本为 1.0.0.0,并且缺少 PublicKeyToken,并且不存在虚假程序集。 什么会导致 JITer 和 ngen 尝试加载这个错误版本的程序集?
程序集的正确版本位于 GAC 中。 我已在 Reflector 中打开图像,并且参考在那里正确显示。 我还验证了依赖关系层次结构中没有其他程序集加载伪造的 1.0.0.0 版本。 事实上,1.0.0.0版本在任何地方都不存在,无论是在开发箱上还是在测试机上。
但是,当尝试在测试机上扩展对 Microsoft.Xna.Framework 的引用时,Reflector 认为(正确地)引用的程序集版本是 2.0.0.0,但即使我可以在 GAC 中看到它,它也找不到它在资源管理器中查看 c:\windows\Assembly。
请帮忙。
I have an application which references the assembly "Microsoft.Xna.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d". I have created an installer project that installs this assembly in the GAC (by running the XNA redist installer).
However, when this assembly is first used, I receive an exception during JITing. I then tried to ngen the image, and ngen gives the following error message:
Failed to load dependency Microsoft.Xna.Framework of assembly x,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null because of the following
error : The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Note that the version is 1.0.0.0 and the PublicKeyToken is missing, and bogus assembly does not exist. What can cause the JITer and ngen to attempt to load this bad version of the assembly?
The correct version of the assembly is in the GAC. I have opened my image in Reflector, and the reference shows correctly there. I have also verified that no other assembly in the dependency hierarchy loads the bogus 1.0.0.0 version. In fact, the 1.0.0.0 version does not exist anywhere, neither on the development box nor the test machine.
However, when trying to expand the reference to Microsoft.Xna.Framework on the test machine, Reflector thinks (correctly) that the referenced assembly version is 2.0.0.0, but it can not find it even though I can see it in the GAC when viewing c:\windows\assembly in explorer.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(注意 - 外部 1.0 dll 的编辑日期之前)
您是否使用任何外部 dll? 也许某些 3rd-party xna dll 引用了 1.0 版本。 如果这一点首先被发现,那么所有的赌注都可能会失败。 尝试查看反射器中的任何外部 dll,看看它们引用的版本。 您还可以尝试为 xna dll 添加 版本策略 。
(note - pre-dates edit re external 1.0 dlls)
Are you using any external dlls? Perhaps some 3rd-party xna dll that is referencing the 1.0 version. If this gets discovered first, all bets may be off. Try looking at any external dlls in reflector, so see what version they reference. You could also try adding a version policy for the xna dll.