Sunday, May 1, 2011

How can I get tlbimp to not automatically generate assemblies for referenced types?

I want to create an interop assembly from a type library using the tlbimp.exe tool that is included in the .NET SDK.

My problem is that the source type library is referencing a type in another library that I do not have available. How can I get tlbimp to not automatically generate assemblies for referenced types?

I get the following error:

Resolving reference to type library 'GridEX20'. 
Auto importing 'GridEX20' to 'C:\tmp\GridEX20.dll'. 
TlbImp : error TI0000 : System.Runtime.InteropServices.COMException - Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))

Using Process Monitor I have concluded that the GridEX20 library is found but it refers to another library that is not found and tlbimp reports an error when this library can't be found.

From stackoverflow
  • You can try the /strictref option, but I don't think it's going to help you.

    I suggest you examine the GridEX20.dll with Dependency Walker (for VS2005, it was found in C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin, but I don't think it's shipped any more - you can find a version here).

    That should tell you which assemblies the dll depends on - which will at least confirm whether your initial hypothesis is correct.

0 comments:

Post a Comment