How to use tlbimp2.exe in Visual Studio 2005/2008?

Apr 18, 2009 at 2:41 AM

Big thank you for your work on tlbimp2.

Since I am working on doing a few customizations to the tlbimp2 source code to suit my project's needs, I was wondering if you knew how I could have Visual Studio use my version of tlbimp2 instead of whatever it uses by default when I do an "Add Reference" of a COM component.

I originally thought that Visual Studio just used the standard tlbimp tool that comes with the .NET Framework SDK, but I've realized that it doesn't.  So I am not sure how I could get Visual Studio to point to my version of the tlbimp tool.

Is it possible?

Apr 20, 2009 at 3:18 PM
As far as I know, Visual Studio 2005/2008 is calling into the TypeLibConverter API in mscorlib and it is implemented by CLR, so it is not possible to have VS to use your own version of TLbImp at this moment. For now, please use your own version of TlbImp to generate interop assembly and then use VS to add reference to the interop assembly you've just created. We are looking at creating an VS addin or a standlone tool to make the process easier, but the plan is not finalized yet. If the current workaround doesn't quite work for you, feel free to let us know.

Apr 20, 2009 at 9:34 PM
Hi Yi,

Thanks for the info.

I am unfortunately in a position where our project still has active VB6 development along side some C#.  Because the VB6 components referenced by the C# code changes frequently, I would be forced to ask our developers to frequently run the tlbimp tool on the side and then add reference on the generated interop assembly.  For now, I think I am going to pass on my customized tlbimp so that the rest of the team doesn't have to change the way they work with their COM references in VS.

I am very hopeful however that things will become a lot easier if a VS add-in is implemented in the future.

Thanks for your hard work, I'll keep checking back for further developments.