如何让 tlbimp 不自动生成引用类型的程序集?
我想使用 .NET SDK 中包含的 tlbimp.exe 工具从类型库创建互操作程序集。
我的问题是源类型库引用了另一个我没有的库中的类型。 如何让 tlbimp 不自动生成引用类型的程序集?
我收到以下错误:
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))
使用 进程监视器 我得出的结论是找到了 GridEX20 库,但它引用了另一个未找到的库,并且当找不到该库时 tlbimp 会报告错误。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试 /strictref 选项,但我认为它不会对您有帮助。
我建议您使用 Dependency Walker 检查 GridEX20.dll(对于 VS2005,它位于 C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin 中,但我认为它不再提供 - 您可以找到版本此处)。
这应该告诉您 dll 依赖于哪些程序集 - 这至少会确认您最初的假设是否正确。
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.