我有 C#.net exe,我向其中添加了对第三方 dll 的引用。
这些第三方 dll 是在 GAC 中注册的强命名程序集。
我用第三方 dll(比如 7.0 版)编译我的程序。
当我尝试在一台机器上注册我的 C#.net exe 程序时,该机器已经在 GAC 中注册了第三方 dll(比如版本高于 7.0)。
如果在几台机器上随机失败,当我使用目标机器中存在的 dll 版本重新编译我的 C# 项目时,它再次指出“无法找到程序集版本 7.0 类型未注册”,它运行成功..
注意: A。假设项目最初是用程序集版本 7.0.4.82 编译的,并试图在 11.0.367.0 中运行。 b. Test.Framework、Test.Core 是引用的程序集。
解决步骤:
尝试使用以下 app.config 文件进行程序集重定向技术。
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<assemblyIdentity
name="Test.Framework"
publicKeyToken="ebf6b2ff4d0a08aa" culture ="neutral"/>
<bindingRedirect oldVersion="7.0.4.82"
newVersion="11.0.367.0" />
<publisherPolicy apply="no" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity
name="Test.Core"
publicKeyToken="ebf6b2ff4d0a08aa" culture ="neutral"/>
<bindingRedirect oldVersion="7.0.4.82"
newVersion="11.0.367.0" />
<publisherPolicy apply="no" />
</dependentAssembly>
</assemblyBinding>
请建议我采取一些步骤来解决此问题。
提前致谢。
请您参考如下方法:
我的建议:
