是否有可能实现.NET库二进制兼容性? [英] Is it possible to achieve binary compatibility in .NET library?

查看:142
本文介绍了是否有可能实现.NET库二进制兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net库的COM可见的,它是从VB6的应用程序调用。

I have a .NET library visible in COM, and it's called from a vb6 application.

如果我添加一些方法,并发布一个新版本(但不要删除或更改现有方法的签名),我希望能够仅仅将其安装在生产设备,并有工作。然而,似乎这种做法行不通;我需要reompile VB6的应用程序。

If I add some methods and release a new version (but don't erase or change signatures of existing methods), I would like being able to just install it in the production machine, and have it working. However, it seems that such approach doesn't work; I need to reompile the vb6 application.

有什么办法来实现这一目标?

Is there any way to achieve this?

推荐答案

您可以明确地使用的 的Guid 你的COM接口和类和的 DISPID 你的方法,字段和属性的属性:

You can explicitly use the Guid attribute on your COM interfaces and classes and the DispId attribute on your methods, fields and properties:

[Guid("0E213759-1679-4CD1-8322-566CF76928EF")]
public class SampleClass
{
    [DispId(8)]
    public void MyMethod() {}
}

这篇关于是否有可能实现.NET库二进制兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆