问题
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