How can I add a COM reference without using Visual Studio?
Maybe I hav开发者_如何学运维e to use some options on the csc command line?
You need to generate an interop assembly for the COM library you want to use, and reference that assembly instead of the COM dll. You can generate the interop wrapper with Aximp.exe (for ActiveX controls) or Tlbimp.exe (for other COM components)
You should use the TlbImp.exe utility to generate an interop assembly from the COM type library and add a reference to the generated assembly with /r
compiler switch.
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. The interop assemblies still need to be referenced in the Visual Studio project.
精彩评论