[英]How can I add a COM reference without using Visual Studio?
也许我必须在csc命令行上使用一些选项?
You need to generate an interop assembly for the COM library you want to use, and reference that assembly instead of the COM dll. 您需要为要使用的COM库生成一个互操作程序集,并引用该程序集而不是COM dll。 You can generate the interop wrapper with Aximp.exe (for ActiveX controls) or Tlbimp.exe (for other COM components) 您可以使用Aximp.exe (对于ActiveX控件)或Tlbimp.exe (对于其他COM组件)生成互操作包装。
您应该使用TlbImp.exe实用程序从COM类型库生成一个互操作程序集,并使用/r
编译器开关添加对生成的程序集的引用。
I have used Aximp.exe and Tlbimp.exe in one of my projects to generate the interop assemblies (to overcome COM component version difficulties) and a BAT file with the calls and comments is available. 我在一个项目中使用了Aximp.exe和Tlbimp.exe来生成互操作程序集(以克服COM组件版本的困难),并且提供了带有调用和注释的BAT文件 。 The interop assemblies still need to be referenced in the Visual Studio project. 互操作程序集仍需要在Visual Studio项目中引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.