I have a ActiveX COM control and its source code. I wanted to change one of the method's input parameter, so I changed the IDL etc and generated the COM DLL and TLB.
But when I imported the COM DLL in a .NET project the method had retained its old signature. So I tried to generate the ActiveX DLL using AXIMP (though it is all the same, I wanted to give a try).
Still the method's signature did not change to what I changed to.
But when I generated the interop DLL using TLBIMP from the TLB file generated, the method signature changed correctly.
Where can I be wrong?
Thanks.
There are a lot of manual steps involved so it easy to miss one. It rather depends on how you imported the type library, there's more than one way to do it. If you picked the reference from the Add Reference + COM tab then the likely mistake is that you forgot to re-register the new COM server. Or you accidentally picked the old one instead of the new one, which can happen when you change the guids, like you should, and forgot to cleanup the old one. Cleaning up is pretty important and easily missed since it needs to be done before you rebuild the COM server. You can end up with a lot of garbage in the registry.
And yes, using Tlbimp.exe directly is the most reliable way to avoid accidents. Since you run it directly on the type library and don't use the registry at all.
A recipe for having the least possible amount of trouble could look like this:
Skipping any of these steps can invoke build trouble, registry pollution, DLL Hell and having an all-around lousy wrecked day without getting anything done.