Interop Dlls question

Y

Yoavo

Hi,
In my application I have to use som external COM dll's.
In the code:
using MyDll

when I build the project, I get (in addition to the .exe file) a Dll called
Interop.MyDll.dll
I want to send the .exe to the users without needing to send the dll.
Is it possible to build my project without the accompanying dll ?

Yoav.
 
D

Dave Sexton

Hi Yoav,

The .dll itself is a managed wrapper around your unmanaged reference.
Without the managed wrapper your program can't run.

Unless that .dll is in the GAC on all users' machines then you'll need to
install it with your .exe.

You can add a Setup and Deployment project to your solution and choose the
project output for your application's project. The .msi file that is
created will install both files.

You can also use ClickOnce in the 2.0 Framework as an alternative if you
want to provide a web installer.

Of course, the last option is to simply copy both files to the users'
machines :)
 
Y

Yoavo

Thanks for the answer.
However, I have a another question regarding this issue:
I have another application that uses the same COM Dll's but use different
interfaces.
Will the resulting interop Dll's will be the same as the first application ?
( Can I use one interop dll for both applications? )

Yoav.
 
D

Dave Sexton

Hi Yoav,

You can have as many different versions of the interop assembly as you'd
like. One for each application is fine.

On the other hand, if there is a PIA (Primary Interop Assembly) provided by
the author then you should use that instead, in which case it's probably in
the GAC.

Whether there is a PIA or the interop assembly is made by you it could be
installed into the GAC so that it's shared by all of your applications, in
one place. Check out the gacutil program or you can simply copy the
assembly into the gac using explorer. (Another option is to use the Global
Assembly Cache folder in a Setup and Deployment project).
 
Y

Yoavo

Is one of the Interop files that are created by one of the applications can
be used as the PIA ?
 
D

Dave Sexton

Hi Yoavo,

PIA is just a fancy name for the interop assembly that a company claims to
be its primary assembly for interoperability with its unmanaged component.
Typically PIAs are a better managed wrapper than what is generated by the
tlbimp program used by Visual Studio.

You can't really make your own PIA unless it's your own unmanaged component
that you're wrapping :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top