We have a setup project that currently adds Project Output's from different visual studio projects. We want to change the packaging system and use a folder with a bunch of deploy files that are prepared for deployment in the setup.
But this means that we need to add the files one by one, and keep adding them on each version when there are new files.
I saw in this question that we can't add files with rules like *.aspx.
So I'm considering creating a small tool that will change the vdproj file based on the files available. Can you help me with the format of this file? It seems there are some GUIDs associated with each file included.
Does anyone have a better solution on how to do this?
We're not thinking about using a different setup tool right just yet, we just look for a simple solution for the file packaging.
10 Answers
To add the entire folder, just open a windows explorer window, then drag all the files you want to add into the file system view.

- 71
- 1
- 1
I finally found a real solution to this problem. What I needed is to add all files in a given external directory, (which is not part of the project), to the setup project in build time, i.e. if a file is added to that external directory, it will be included automatically in the installer with the next build.
What I did is I created a new project in the solution (Class Library project) and removed everything from it: Class1.cs, AssemblyInfo.cs, and the relevant ItemGroups of the csproj file containing <Compile>
elements for the files above and the <Reference>
elements for the includes.
Then, I added a new ItemGroup:
<ItemGroup>
<Content Include="Path\To\The\Directory\**\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
This way, this new project does not contain any files, but it referencing all the files (recursively, indicated by the \**\
from the indicated directory) as Content files.
So, upon build, these files are treated as Content files, therefore copied to the output directory of the new project.
So, why did I do all the above? Just because, Setup Project has an option to include the Content files from another project!
So, this way you can make arbitrary external files "part" of the solution without actually listing them, the list of the files is evaluated in build time, and then reference them from a Setup project.

- 169
- 1
- 12
-
1This in conjunction with some\folder\%(RecursiveDir)%(Filename)%(Extension) as described in https://stackoverflow.com/a/47738053/1075062 to place files in specific output folder with original hierarchy (else all files are dumped in output root). – Etherman May 24 '20 at 12:45
It seems there was no easy solution for this question. We ended up changing the setup tool and using Advanced Installer to create the setup, it has a nice feature that synchronizes files inside a folder for the deployment.

- 2,535
- 3
- 30
- 50
We had this same issue. You can NOT drag/drop.. But you can go to the contents you want in Windows Explorer, copy the items (which can include sub-folders), then return to VS Installer and paste these (e.g. the application folder).
Note. If you need to create custom folders (e.g. c:\html) you can also use this approach but you must create the custom folder first in the left pane (specifying the absolute path as the target), then again go to the left pane and paste.
This method works to package a set of folders but does NOT SYNC folders that may having varying contents! If the contents change between deployments you must re-copy/paste to get the installer file to contain everything!

- 49
- 1
-
It seems like others saying "just copy, drag/drop, etc" do not really understand the issue here. The problem is to include the _actual_ contents of an external folder which content is _not_ included in any project and is varying over time. – Peter Feb 25 '19 at 10:38
-
+1 Copying the output using Ctrl+C on everything in the output directory and then pasting it using Ctrl+V to the "Application Folder" was the old way I could get it to work. Selecting "File" or "Assembly" resulted in missing files and would not build properly. This must be done every time as mentioned. – SwDevMan81 Jul 23 '21 at 16:17
You can right click on the folder in explorer and click copy and then right click the folder in the file system view in the setup project and click paste. Dragging and dropping did not work for me.

- 2,033
- 2
- 23
- 28
Could you just add all the files from the folder with a macro??
Also maybe you can just clear the files on the setup project (with a macro or add-in) and add the files in the folder with the same method..

- 2,129
- 27
- 35
-
It can be a solution. I don't know much about macros on VStudio, so 2 questions: -How easy is to change the macro to browse the file system? -Can I run the macro from command line, so I can run it in an automatic way? – pauloya Apr 15 '09 at 15:39
-
The macro is just a function like any other, that do things on the IDE. so yes, you can add browse functionality. About the command line, I don't know, and I don't think so, because it lives inside the IDE. – gbianchi Apr 15 '09 at 16:43
The following works perfect: Simply drag and drop the folder to Setup directory (use the windows explorer not the solution explorer). Then it will add all files within it and all the sub folders.

- 11
- 1
I have the same issue. Although not the ideal solution, one idea I've had is to have a batch file that zips the files up and then my setup project just distributes that zip. After that, you'd have to unzip them after installation.
Alternatively, you could write a small app to compress them into a single file and decompress them when the app runs the first time. Basically the same solution, except you write it yourself so no need to use a third party unzip tool and the installation process is a little cleaner.
I think I'm actually going to do the latter solution for my project soon because I'm not looking at paying the big bucks for a better install app just yet either.

- 8,590
- 15
- 65
- 120
- You can right click inside the folder(that needs to be copied) in windows explorer and click Ctrl+A or select all the files and click copy.
- In the FileSystem editor, navigate to the the left side. Then right click on the application folder and click Add and select folder.
- Give the name to the folder
- On the right side of the FileSystem editor, right click and select Paste
- All the contents of the folder will get copied into the newly created folder in step 2.
For further information, refer following link https://dzone.com/articles/creating-msisetup-package-c

- 293
- 3
- 12
-
This is a simple straight forward manual solution, with requiring any macros. Also drag and drop does not work in this case. – jo_Veera Mar 26 '19 at 14:56