本文介绍了COM /互操作 - 支持多版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个.NET控制台应用程序,它包装的CuteFTP的传输引擎 - 一个COM对象(ftpte)。我包的版本是CuteFTP的7.0。我想还支持8.0版本,因为我的一些集成的客户有一个版本。

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.

我在Visual Studio项目的CuteFTP的COM对象的引用......我怎么可以参考8.0版组件,还支持7.0版本?这在我看来,我被迫选择在设计时,除非我做一个更大的架构转变。

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.

想法?

推荐答案

您需要引用您需要支持的最低版本,并考虑到新的版本不改变API,但只是增加新的功能,你应该好。但它显然取决于应用程序开发人员不会打破API。

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.

这篇关于COM /互操作 - 支持多版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 21:02
查看更多