Adding Files to an Installer Project

The Microsoft® Windows® installer works with files grouped as installer components. From a development point of view, a component is the building block of an installed application. Each component consists of one or more logically related files (and, sometimes, additional elements such as registry entries) grouped together.

In Microsoft® Visual Studio® Installer, every file added to your project belongs to a component. A unique file or registry key identifies each component. For information about component registry keys, see Manipulating the Target Machine Registry.

When you add a file to an installer project, you create a component with that file as the key file. After adding several files to an installer project, you can group them together to create multi-file components.

You can add files to the installer project in several different ways:

  • To simply add source files to the installer project (and save configuring where they are installed on target machines until later), use the Project Explorer. For more information, see To add files with the Project Explorer.

  • To specify where to install files on target machines when you add the file to the installer project, use the File System editor. For more information, see To add files with the File System editor.

  • Sometimes it might be quickest to add files and specify their target installation directories by dragging the files from the Windows Explorer to the Visual Studio Installer File System editor. For more information, see To add files with the Windows Explorer.

    Tip   To facilitate sharing projects between multiple development machines, Microsoft recommends you keep all source files you add to an installer project in the project directory (or its subdirectories) on your development machine.

To add files with the Project Explorer

  1. In the Project Explorer window, select your Windows installer project.

  2. On the Project menu, click Add File(s).

    Note   You can also reach the Browse for Files dialog box by right-clicking the installer project name in the Project Explorer, highlighting Add, and then selecting File(s).

  3. In the Browse for Files dialog box, navigate to and select the files you want to add.

  4. Click Open.

    You can see the files you added listed in the installer project's Files node in the Project Explorer. Unless you regroup the files, each file is its own component and will be installed in the end user's application installation directory.

To add files with the File System editor

  1. In the Project Explorer, expand the Target Machine node under your installer project.

  2. Double-click File System in the Target Machine node.

  3. In the File System editor, right-click the folder you want to add files to.

  4. Select Add File(s) from the context menu.

  5. In the Browse for Files dialog box, navigate to and select the files you want to add.

  6. Click Open.

    The File System editor displays the files you added in the folder you selected. The files are also listed in the installer project's Files node in the Project Explorer. Unless you regroup or move the files, each file is its own component and will be installed in the selected directory.

To add files with the Windows Explorer

  1. In the Project Explorer, expand the Target Machine node under your installer project.

  2. Double-click File System in the Target Machine node.

  3. In Windows Explorer, select the files you want to move.

  4. Drag the selected files from the Windows Explorer to the folder representing their installation target directory in the File System editor.

    The File System editor displays the files you added in the folder you selected. The files are also listed in the installer project's Files node in the Project Explorer. Unless you regroup or move the files, each file is its own component and will be installed in the selected directory.