Setup project with two primary outputs using common dependencies

2.1k Views Asked by At

I have a solution in visual studio with 4 projects - 2 windows form applications, a class library and a setup project.

The 2 windows forms applications both reference the class library project.

My setup project includes the primary outputs for both windows forms application, and the detected dependencies include the class library.

I've put one of the primary outputs in the Application Folder, and the other in a sub folder. The problem is that the class library assembly only gets installed in the application folder directory but I also need it in the sub directory, otherwise one of the windows form applications will not run. How can I get it to install in both places? Is it possible to do without manually adding the assembly?

3

There are 3 best solutions below

0
On

Very easy:

For each setup project that needs to refference some assemblies and use each of them in 2 different locations, create 2 MergeModuleProjects. The first one contains the file system regarding one of the assemby locations, the other one contains the file system regarding the other assembly location. Then the Setup project which you initially had will only refference the 2 MergeModuleProjects. setup project vs merge module projct

Example: Setup1 has the following file system:

folder1
{
  folder2
  {
    assembly1
  }
  folder3
  {
    asembly3
  }
}

Then you replace the structure above with the following one:

Setup1 had the following file system: (none) Setup1 refferences MergeModule1 and MergeModule2 MergeModule1 has the following file system:

folder1
{
  folder2
  {
     assembly1
  }
}

MergeModule2 has the following file system:

folder1
{
   folder3
   {
     assembly1
   }
}
0
On

The easy solution would be to install both .exes in the same folder as the .dll they need to run. You could put a shortcut to the second .exe in a subfolder, if you want.

0
On

Hope this is still relevant. This is how I did it. Assuming all the dependencies are copied to your projects' output directory:

  1. Right click Add > Assembly...
  2. Go to your projects output directory and select the dlls needed
  3. Remove duplicates if any