How To Structure Your Installation Directories

<< Back to the MSI page

This tutorial gives a step by step instruction on how to install your program so that it is organize by folders. For this example, we will structure your installation so it includes both source and executables in sub-folders called source and bin.

Assuming you have already created the setup the project, and that you have done the previous tutorial, follow these steps.

Step 1. Add source files to your installer You can do this in one of two ways.

  • if you are using the project setup wizard, one of the dialog boxes will have asked you what Project Output Groups you want to add. Select
    • Source Files to include all source files in the project
    • Localized resources to include satellite assemblies for each culture's resources
    • Content Files for all content files in the project
  • Alternately, you can do this afterwards by:
    • Right click on the setup project in the Solution Explorer window.
    • Expand the Add option.
    • Select the Project Output option.
    • You will see the Add Project Output Group, which will allow you to add the files and resources mentioned above.

Step 2. Enter the File System view You've already learnt how to do this in the previous tutorial. To repeat:

  • Right click on the setup project in the Solution Explorer window.
  • Expand the View option.
  • Select the File System option.
  • You will see a treeview with File System on Target Machine as the root, with Application Folder, User's Desktop, and User's Program Menu underneath it.

Step 3. Creating the source and bin folders

  • Click on the Application Folder item in the treeview. The pane to the right should appear containing all the items you want included in the project, e.g., Primary output for..., Source files from..., etc.
  • Right-click on either the Application Folder item, or in an empty space in the righthand pane.
  • From the context menu that appears, choose Add and then select Folder.
  • Name the foler source.
  • Repeat the above for a folder called bin.

Step 4. Moving the output files into the folders

  • Using standard drag and drop techniques, drag the appropriate items from the right hand pane into the folders. For example,
    • move Primary output for... into bin, which will put the executable there.
    • move Source files from... into src, which will put the source files there.

Note that you can use similar strategies to create folders in the User's Program Menu and even the User's Desktop.

An example screen shot showing the bin directory expanded is below. Now rebuild and test this by running the .msi -- you should now see these folders in the Program Files folder, with the various installed files contained within them.