views:

30

answers:

1

When registering .NET assemblies for COM Interop, I do two things, currently in this order:

regasm /tlb:MyDll.tlb Mydll.dll

gacutil /i Mydll.dll

I use regasm to register the type library for COM and gacutil to install the assembly into the GAC. Does it matter which order I do these two actions? Also, as I make updates to my dll, do I need to un-register and re-register it, uninstall it from the gac and re-install it, both or neither?

+1  A: 

Does order matter?

No.

Do you need to reinstall in GAC when the dll has changed?

Yes.

Do you need to re-register for COM when dll has changed?

That depends. If you added new types in your COM dll, then yes. If you only changed a few internal things in existing types, then no. To be safe though, always un-register and re-register.

Jakob Christensen
@Jakob thanks for the answer. I went through the ceremony of un-registering and re-registering as well as un-gac-ing and re-gac-ing. The VB6 sees the new types I added, but for whatever reason, it throws an error that it can't find the types specified at runtime. Why might that be?
Ben McCormack
Typically the errors from VB6/VBA are not very informative. You can try not adding your assemblies to GAC and instead register them with regasm using the /codebase switch and see if that helps.
Jakob Christensen
@Jakob I've gotten `/codebase` to work for me in the past, but I still have questions as to how this is supposed to work. I started another question that stems from this issue: http://stackoverflow.com/questions/3062754/do-i-need-to-force-the-gac-to-reload-an-assembly-is-this-possible
Ben McCormack
FYI - I got everything to work again simply by saving my VB6 project and restarting the IDE.
Ben McCormack
You gotta love VB6 :-)
Jakob Christensen