Modifying the File Structure of Installer Components

See Also

Because it is based on the Microsoft® Windows® installer, Microsoft® Visual Studio® Installer works with files grouped as components. Every file you add to an installer project is initially the key file for its own complete component. For example, when you add File1.txt to your Visual Studio Installer project, you create a component that contains only File1.txt. File1.txt is also established as the key file for this component. Any additional files you now add to the component will be non-key files.

Note   Registry entries may also be included in components and can be component keys. For information about working with registry entries in components, see Manipulating the Target Machine Registry.

You may want to modify the file structure of your installer components. With the Visual Studio Installer File System editor, you can easily:

You can also manage the file structure of components by working in the Component Properties dialog box. For more information, see Component Properties Dialog Box.

To group files in components

  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, select the folder that contains files you want to group in a component.

    Note   All files included in a component must be maintained in the same folder on the target machine. By default, Visual Studio Installer initially adds files in the Application Folder. You may want to move the files you want to group so they are all in the same target folder.

  4. Select the files you want to group into a component.

    Important   You can only select files to group into components. Your selection cannot include a shortcut or a folder.

  5. Right-click the file you want to establish as the component's key file.

    Note   Notice you set the component key file by right-clicking it. If your selection already includes a key file but you don't right-click that file here, it will be demoted (along with all its non-key files) to a non-key file in the target component.

  6. From the context menu, choose Group.

    The right pane of the File System editor displays the selected files grouped together as a component. The component key icon with the key file's name indicates the key file. Non-key files are indented in the display and subordinate to the key file.

    If you select one of these files, the Component property in the Properties window also reflects the component structure.

To ungroup files from a component

  1. Select the files you want to ungroup from the component. If you want to ungroup all files in the component, select the component's key file. (This is equivalent to selecting all files in the component.)

  2. Right-click your selection.

  3. From the context menu, choose Ungroup.

    Selected files are ungrouped from the component. Each ungrouped file becomes the key file for its own new complete component. The right pane of the File System editor shows these new components. The files' Component property in the Properties window also reflects the new component structure.

Tip   You can also ungroup non-key files from components simply by dragging them away from their component key file to any white space in the right pane of the File System editor.

To add files to components

  1. Open the File System editor.

  2. Display the file names you want to add to the component. You may either:
  3. In the right pane of the File System editor or the Windows Explorer, locate and select the files you want to add to the component.

  4. Drag your selection onto the file name of the component's key file.

    The right pane of the File System editor shows the selected files were added to the component. The files' Component property in the Properties window also reflects the new component structure.

To move files among components

  1. Open the File System editor.

  2. Select the folder containing the component you want to modify.

  3. In the right pane of the File System editor, select the files you want to move to another component.

    Note   If you select a component key file, all the files in that component will move with it. If you select a non-key file within a component, you will delete only that file from the existing component.

  4. You can now drag your selection to its destination:

    The file hierarchy in the File System editor's right pane shows component structures, with subordinate files grouped together under key files. You can also review which files belong to which components by checking the file's Component property in the Properties window.

To delete files from components

  1. Open the File System editor.

  2. In the right pane of the File System editor, locate and select the files you want to delete from a component.

    Note   If you select a component key file, you will delete only that file and not any other files in the component. To delete an entire component, see To delete components.

  3. Press the DELETE key.

    Note   If you delete a component's key file, all remaining files from that component become key files for their own complete component.

To move components

In the File System editor, you can move a component from one folder to another on the target machine.

  1. Open the File System editor.

  2. Select the folder containing the component you want to move.

  3. In the right pane of the File System editor, select the key file for the component you want to move. You can select more than one key file to move multiple components to the same destination.

    All files in a component will move with the selected key files.

  4. Drag the key file onto the target folder name in the left pane of the File System editor.

    The component you moved is placed in the new target folder.

  5. To verify the component has been moved correctly, select the new target folder in the left pane of the File System editor. The folder contents displayed in the right pane now include the component you moved.

To delete components

  1. Open the File System editor.

  2. In the File System editor, locate and select the component you want to delete from the installer project.

  3. Select all the files in the component.

  4. Press the DELETE key.

    The entire component is deleted from the installer project.

    Important   You must select all files in the component to delete the component. If you select only the component key file, you will delete only that file. When you delete only the component key file, all non-key files in the component become key files of their own individual components.