eigenein
eigenein

Reputation: 2200

How to add a reference to native COM library in Visual Studio?

There is the Deploying COM Components with ClickOnce article in MSDN that says that native DLLs also could be referenced:

To add a native reference, use the Add Reference command, then browse to the manifest.

So, I'm trying to reference Skype4COM library. I've generated a manifest using mt tool. But when I try to reference this manifest, VS says me:

Add Reference error.

What am I understand or I'm doing wrong?

Upvotes: 1

Views: 1307

Answers (1)

Hans Passant
Hans Passant

Reputation: 941397

You are mixing up deploying with building. Adding a reference requires a type library or a DLL that contains a type library embedded inside the DLL. Skype4com.dll has one but it has a problem which prevents it from being added through the Add Reference dialog.

Use the Visual Studio Command Prompt from the Start + Programs menu. Use cd to navigate to the correct directory and type tlbimp skype4com.dll. You'll get a warning that you can ignore as long as you are running 32-bit code. Go back to VS and use Add Reference, Browse tab and select the generated SKYPE4COMLib.dll file.

Upvotes: 2

Related Questions