COM/Interop - Supporting Multiple Versions

北战南征 提交于 2020-01-14 22:45:26

问题


I've written a .NET console app that wraps CuteFTP's Transfer Engine - a COM object (ftpte). The version I wrapped is CuteFTP 7.0. I'd like to also support the 8.0 version, as some of the clients I integrate with have that version.

I have a reference in my Visual Studio project to the CuteFTP COM object... how can I reference the version 8.0 component and still support version 7.0? It seems to me that I'm forced to choose at design time, unless I make a bigger architectural shift.

Ideas?


回答1:


You need to reference the lowest version you need to support, and given that the new version do not change the API, but just add new functionality, you should be OK. But it clearly depends on application developers to not break the API.

That way, you will miss any new functionality added in the newer version, but at least old functionality should work.




回答2:


Look at my hobby open source project MS Office Wrapper for .NET. There is used a "late-binding" which allows you to use a different version of COM libraries.



来源:https://stackoverflow.com/questions/258972/com-interop-supporting-multiple-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!