Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to achieve binary compatibility in .NET library?

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

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?

like image 408
raven Avatar asked Sep 18 '25 23:09

raven


1 Answers

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() {}
}
like image 189
Dirk Vollmar Avatar answered Sep 21 '25 00:09

Dirk Vollmar