开发者

change interop dll version created in vb6 when using in .net

开发者 https://www.devze.com 2023-01-28 16:59 出处:网络
I\'m facing problem while reference vb6 dll in .net project. When ever i refer a vb6 dll in .net project the interop dll is created with same version(1.2.0.0). Its creating problem for me as the setup

I'm facing problem while reference vb6 dll in .net project. When ever i refer a vb6 dll in .net project the interop dll is created with same version(1.2.0.0). Its creating problem for me as the setup used to deploy the application at client side does not replace the dll if the version is same as before. I want to change the version of the interop dll (created using vb6 dll). I read it cam done using tlbIMP but how to create tlb fi开发者_开发问答le for vb6 dll. Or is there is any other way to achieve this.

Thanks Saurabh


Here's a small batch file we use to create our interop dll so it's strongly named:

sn.exe -i MichiganLTAP.pfx MagicContainerName

tlbimp.exe ourVb6.dll /out:Our.Strongnamed.Interop.dll /asmversion:7.1.0.0 /keycontainer:MagicContainerName /machine:X86 /namespace:Our.Strongnamed /verbose /sysarray

sn.exe -d MagicContainerName

The important switch from your perspective is: /asmversion:7.1.0.0

You should be able to set that to whatever you want. Check out the MSDN Library page for more info on the switches available.


It makes very little sense to make the version number of the interop library different from the version number of the type library that was created by VB6. There is a one-to-one mapping between what's in the interop library vs the code you wrote in VB6. The interop library simply contains IL declarations for the VB6 COM interfaces, there is no actual code. The CLR uses it to quickly generate the RCW for the interface.

Change the type library version number in VB6 with Project + Properties, Make tab, Version number. Major and minor is what counts. Do this only when you make a change in the publicly visible VB6 classes. Doing so is required btw, it avoids DLL Hell.

0

精彩评论

暂无评论...
验证码 换一张
取 消