'Visual Studio Setup Project - how to avoid duplicate entries?
It's the first time I use Visual Studio Setup to create an installer, and there's one thing I don't understand.
I've added the files I want via simple drag-and-drop, but the end result is that the installer creates a lot of duplicate entries, like this:
in other words, for almost every one of my .dll files, Visual Studio adds a duplicate .DLL file with the same name, that cannot even be deleted.
While the final generated installer still works correctly (because I assume one of the duplicates is overwriting the other) it has the annoying side-effect of generating a lot of warnings and also of making the final .MSI file almost twice as big as it needs to be.
How do I avoid this?
Solution 1:[1]
From your brief description in your comment, it's unclear how/why the duplicate DLLs are appearing. But if you want to tweak what's been added, you have a few options.
If you want to remove a DLL from the Application Folder, you can try to select the Application Folder from the left pane then right-click the DLL to see if a Delete option appears. If it does, you can delete it that way.
If the DLL has dependencies, you will need to remove it another way: Go to the Setup Project entry in Solution Explorer and you will possibly see DLLs listed under it. Also, expand the Detected Dependencies list to see likely more DLLs. You can cherry-pick which DLLs you want to exclude by right-clicking a specific DLL and selecting Exclude. When you exclude successfully, the list of DLLs in your Application Folder pane will be shortened.
This advice should get you past your current roadblock.
Solution 2:[2]
I got stuck on this issue for a while after I changed the .NET version of my project. The Setup project didn't automatically update, even when creating a new Setup project, it still created with the duplicates.
My solution:
- Right click on the Setup project and click on "Properties"
- Click on "Prerequisites"
- Change the .NET version to match the one on your main project and remove any that are incorrect.
- Press OK
- Build the solution (important)
The duplicates should now be removed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jazimov |
| Solution 2 | user2924019 |

