3

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:

enter image description here

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?

Jazimov
  • 12,626
  • 9
  • 52
  • 59
Master_T
  • 7,232
  • 11
  • 72
  • 144
  • Please give more detail regarding the step: "I've added the files I want via simple drag-and-drop". – Jazimov Jan 09 '19 at 17:41
  • @Jazimov: I dragged all the files I want to include in the installer from windows explorer and dropped them onto the "File System on target machine -> Application Folder" entry that you see in the screenshot above. This adds all the files and subfolders structure correctly, the only problem are the duplicate entries being generated. – Master_T Jan 10 '19 at 15:47
  • What type of windows installer project did you use ? Sounds like it is grabbing the dependencies for your main executable and with you adding them also is what’s causing your duplicates. – Mark Hall Jan 10 '19 at 18:18
  • @MarkHall: that might be the case... how do I set it up to disable automatic dependency inclusion? I just want to add the files I have in a folder and that's it... I don't need all the extra stuff. Is it possible? – Master_T Jan 11 '19 at 08:28

2 Answers2

1

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:

  1. Right click on the Setup project and click on "Properties"
  2. Click on "Prerequisites"
  3. Change the .NET version to match the one on your main project and remove any that are incorrect.
  4. Press OK
  5. Build the solution (important)

The duplicates should now be removed.

user2924019
  • 1,983
  • 4
  • 29
  • 49
0

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.

  1. 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.

  2. 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.

Jazimov
  • 12,626
  • 9
  • 52
  • 59
  • Thanks for your reply. I had already found the "exclude" option, but since there are a lot of DLLs in the project I was wondering if there was a way to avoid creating the duplication in the first place, rather than manually exclude every single one – Master_T Jan 11 '19 at 08:49
  • You said in your OP that Visual Studio adds duplicate DLLs "that cannot even be deleted". Also, you apparently don't want to give any further details regarding how exactly you are adding your files. I understand drag-drop, I don't fully understand how you're getting duplicates unless I know more about how you are selecting your source files. My answer--which is correct--tells you how to remove duplicates. Maybe you already discovered the "exclude" option (and for some reason declined to mention that before)--but I also presented to you a delete option. My answer at least partially helps. – Jazimov Jan 11 '19 at 15:37
  • I didn't get into more details because there aren't any :) I just drag-n-dropped the files from a folder and that's it. When you do this, they get added with the duplicates... there's not much more to say! Your answer did help, in fact at the moment I'm using the exclude option. I was just waiting to see if someone had a better solution (i.e.: a way to avoid generating the duplicates in the first place). I'll accept your answer if someone doesn't provide a better one soon. – Master_T Jan 14 '19 at 09:45
  • 1
    What I was getting at is this: To prevent the problem from happening in the first place, don't drag-drop duplicate DLLs or DLLs that have duplicate references... The "details" I was seeking is for you to reveal that you are the one duplicating the entries while drag/dropping assemblies into the list. The "dumb" VS setup project is simply obliging your request to duplicate DLL entries, hence the warnings. Now if Microsoft wanted to make these setup projects "smarter", they could provide logic to determine whether there are duplicate and auto-clean them--alas, that feature doesn't exist yet. – Jazimov Jan 14 '19 at 15:04
  • 2
    That's what I wanted to confirm, that it is just VS being "dumb" basically and not auto-clearing duplicate... ok, I'll exclude them manually then. Thanks for your answer. – Master_T Jan 14 '19 at 16:43