[英]How to handle application with 3rd party dll reference
I am writing ac# WinForms application. 我正在编写ac#WinForms应用程序。 I reference a 3rd Party dll (SDK) to perform specific tasks.
我引用了第三方dll(SDK)来执行特定任务。 I expect this dll to be installed on clients machine.
我希望此dll安装在客户端计算机上。
Now, if I use say Version 1 as reference , and client has Version 1 installed. 现在,如果我使用Version 1作为参考,并且客户端安装了Version 1。 The application works.
该应用程序正常工作。
Later, if the client has upgraded to Version 2, my application wont work because, there is no more Version 1 dll. 以后,如果客户端已升级到版本2,则我的应用程序将无法运行,因为没有更多的版本1 dll。
How do I code my application? 如何编写我的应用程序代码? One for each version of the 3rd party dll?
每个版本的第三方dll一个? or is there a better way?
或者,还有更好的方法? (SDK is backward compatible)
(SDK向后兼容)
You can add an assembly binding redirect to app.config. 您可以将程序集绑定重定向添加到app.config。 Something like this:
像这样:
<dependentAssembly>
<assemblyIdentity name="someAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.