How to: Add a File Launch Condition

Predefined file launch conditions allow you to add both a file search and a launch condition in a single step based on the search. For example, you might search a target computer for a specific file, and then use the launch condition to evaluate the result of the search. If the search is not successful, the launch condition will display an error message dialog box and the installation will be terminated.

NoteNote:

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To add a file launch condition

  1. In the Launch Conditions Editor, select the Requirements on Target Machine node.

  2. On the Action menu, choose Add File Launch Condition.

  3. Select the Search for File node. In the Properties window, select the FileName property and type the name of the file to search for.

  4. Select the Folder property and type the name of the folder where the search will start. This can be either the bracketed name for a Windows Installer special folder (for example, [ProgramFilesFolder]) or the full path to any folder (for example, C:\Program Files\MyProgram).

  5. Optionally, set the additional properties to specify the depth (levels of folders to search), date, size, and version.

    NoteNote:

    The Property property value matches the Condition property value in the launch condition. If you change the Property property, you must also change the Condition property to match.

  6. Select the Condition node. In the Properties window, select the Message property and type the error message that will be displayed if the file is not found.

    NoteNote:

    For more information about the Condition property, see Conditional Statement Syntax.

Community Additions

Show: