programmernovice
programmernovice

Reputation: 3941

How can I add a COM reference without using Visual Studio?

Maybe I have to use some options on the csc command line?

Upvotes: 0

Views: 455

Answers (3)

Peter Mortensen
Peter Mortensen

Reputation: 31598

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.

Upvotes: 0

Thomas Levesque
Thomas Levesque

Reputation: 292415

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)

Upvotes: 3

Mehrdad Afshari
Mehrdad Afshari

Reputation: 421988

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.

Upvotes: 2

Related Questions