Deploying with My DLLs

J

jp2msft

I've created some DLLs for our projects, and I would like each project to
access the same DLLs.

In my Setup and Deployment project, after I add the primary output, I can
easily add the dependant DLL files.

As long as I keep the DLL files in the same directory as the primary output,
everything is roses (good).

If I try to create common folder or copy them to a Program Files > Common
Folder subfolder of mine, the DLLs can not be found after I install and try
to execute my application.

How do I tell setup that my primary output should look for its DLLs in some
other folder?
 
A

Alberto Poblacion

jp2msft said:
I've created some DLLs for our projects, and I would like each project to
access the same DLLs.

In my Setup and Deployment project, after I add the primary output, I can
easily add the dependant DLL files.

As long as I keep the DLL files in the same directory as the primary
output,
everything is roses (good).

If I try to create common folder or copy them to a Program Files > Common
Folder subfolder of mine, the DLLs can not be found after I install and
try
to execute my application.

How do I tell setup that my primary output should look for its DLLs in
some
other folder?

The "standard" way of creating shared DLLs in .Net is to install them to
the GAC (Global Assembly Cache).
In order to be able to install the DLLs to the GAC, you first have to
give them a Strong Name. This is well documented in various places, so a
simple search will quickly tell you how to do this.
On your development workstation you can test the DLLs by dragging and
dropping them to c:\windows\assembly using Windows Explorer. This installs
the DLLs to the GAC, and you can verify that your various programs can use
those DLLs from any folder.
In your Setup Project in Visual Studio, in the File System Editor, choose
the option "Add Special Folder", select "Global Assembly Cache", and add
there your DLLs. This will deploy the DLLs to the GAC when running Setup in
the target machine.
 
T

Tantr Mantr

Another option is to use the Post Build Event in you project properties Build
Events to copy the common dlls to the output folder.

Cheers!
 

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