HOW TO: Use AppSearch in a Windows Installation Package (827019)



The information in this article applies to:

  • Microsoft Windows Installer
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Platform Software Development Kit (SDK) 1.0

SUMMARY

This step-by-step article discusses how to use the AppSearch tool in a Microsoft Windows Installer package installation. Windows Installer can use AppSearch to search for a specified registry entry, file, or folder while installing your package.

AppSearch searches your computer for file signatures that you specify in the AppSearch table of the Windows Installer package. If AppSearch locates a file, a registry key, or a folder that has the signature that you specified, AppSearch returns search results as a property. You can use this property to establish a launch condition. If the condition that you set is not satisfied, the launch condition quits the installation process.

AppSearch uses database tables such as the following while searching for files, registry keys, and folders:
  • Signature
  • AppSearch
  • DrLocator
  • RegLocator
  • CompLocator
You can use a table editor tool such as Orca to create or to edit database tables in Windows Installer packages.

The sample discusses how to search for the System.Windows.Forms.dll file during installation of a Windows Installer package that you create by using Microsoft Visual Studio .NET. The sample uses the Orca editor to modify the .msi file and to add the search condition.

back to the top

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
  • Microsoft Windows 2000, Microsoft Windows XP, or Microsoft Windows Server 2003
  • Microsoft Visual Studio .NET
  • Microsoft Platform Software Development Kit (SDK)
This article assumes that you are familiar with the following topics:
  • Visual Studio .NET Setup Projects
  • Orca.exe
back to the top

Create a Windows Installer Package by Using Microsoft Visual Studio .NET

To create a Windows Installer package by using Visual Studio .NET, follow these steps:
  1. Start Microsoft Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, click Visual Basic Projects.
  4. Under Templates, click Windows Application, and then click OK.
  5. Add a Button control to Form1.
  6. Add the following code to the Button1_Click event handler:
    MessageBox.Show("This is a test Windows Installation package")
  7. On the Build menu, click Build Solution.
  8. On the File menu, point to Add Project, and then click New Project.
  9. Under Project Types, click Setup and Deployment Projects.
  10. Under Templates, click Setup Project.
  11. In the Name text box, type SearchSetup, and then click OK.
  12. In Solution Explorer, right-click SearchSetup, point to Add, and then click Project Output.
  13. In the Add Project Output Group dialog box, click OK.
  14. In Solution Explorer, right-click SearchSetup, and then click Build.
For additional information about how to create a setup solution for your application, click the following article number to view the article in the Microsoft Knowledge Base:

307353 HOW TO: Create a Setup Package by Using Visual Studio. NET

back to the top

Open the Microsoft Windows Installer (.msi) File by Using the Orca Editor

To open the SearchSetup.msi file, and then add a file search condition by using the Orca editor, follow these steps:
  1. Start Orca.

    Note To download and then install Platform SDK (including Orca), visit the following Microsoft Web site: After you install Platform SDK, install the Orca editor by double-clicking the Orca.msi file. This file is located in the Bin folder that is located in the installation folder.
  2. On the File menu, click Open.
  3. In the Open dialog box, locate the SearchSetup.msi file (located in the SearchSetup\Debug folder).
  4. Click the SearchSetup.msi file, and then click Open.
back to the top

Add New Tables to the .msi File

To add new tables (such as the Signature table, the AppSearch table, the DrLocator table, and the LaunchCondition table) to the SearchSetup.msi file, follow these steps:
  1. Under Tables in the left pane, verify whether the Signature table, the AppSearch table, the LaunchCondition table, and the DrLocator table exist. If these tables do not exist, go to step 2.
  2. On the Tables menu, click Add Table.
  3. In the Add Tables dialog box, click to select the following check boxes:
    • Signature
    • LaunchCondition
    • AppSearch
    • DrLocator
    Click OK.
back to the top

Create the Signature Table

In the SearchSetup.msi file, the Signature table stores information about file signatures.

To create the Signature table, follow these steps:
  1. Under Tables in the left pane, click Signature, and then click Add Row on the Tables menu.
  2. In the Add Row dialog box, click Signature in the Name column, and then type ISFORMSDLL in the Signature - String[72], Required text box.
  3. In the Name column, click FileName, and then type System.Windows.Forms.dll in the FileName - String[255], Required text box.
  4. In the Add Row dialog box, click OK.
back to the top

Create the AppSearch Table

In the SearchSetup.msi file, the AppSearch table contains the FileExists property. The FileExists property is set when the System.Windows.Forms.dll file exists on your computer.

To create the AppSearch table, follow these steps:
  1. Under Tables in the left pane, click AppSearch, and then click Add Row on the Tables menu.
  2. In the Add Row dialog box, click Property in the Name column, and then type FileExists in the Property - String[72], Required text box.
  3. In the Name column, click Signature, and then type ISFORMSDLL in the Signature - String[72], Required text box.
  4. In the Add Row dialog box, click OK.
back to the top

Create the DrLocator Table

In the SearchSetup.msi file, the DrLocator table contains information about the path that the AppSearch tool must search to locate the System.Windows.Forms.dll file.

To create the DrLocator table, follow these steps:
  1. Under Tables in the left pane, click DrLocator, and then click Add Row on the Tables menu.
  2. In the Add Row dialog box, click Signature in the Name column, and then type ISFORMSDLL in the Signature - String[72], Required text box.
  3. In the Name column, click Path, and then type Microsoft.NET\Framework\v1.0.3705 in the Path - String[255] text box.
  4. In the Name column, click Depth, and then type 0 in the Depth - Short text box.
  5. In the Add Row dialog box, click OK.
back to the top

Create the LaunchCondition Table

In the SearchSetup.msi file, the LaunchCondition table contains the conditions that must be satisfied for the installation to start. You can use the FileExists property that is located in the AppSearch table to establish the file launch condition. The file launch condition quits the installation process when the file is not present in the specified location.

To create the LaunchCondition table, follow these steps:
  1. Under Tables in the left pane, click LaunchCondition, and then click Add Row on the Tables menu.
  2. In the Add Row dialog box, click Condition in the Name column, and then type FileExists in the Condition - String[255], Required text box.
  3. In the Name column, click Description, and then type System.Windows.Forms.dll file does not exist. Install the file and continue. in the Description - Localizable String[255], Required text box.
  4. In the Add Row dialog box, click OK.
  5. On the File menu, click Save, and then quit Orca.
back to the top

Verify That the Application Works

  1. Locate the SearchSetup.msi file (located in the SearchSetup\Debug folder) on your computer.
  2. Right-click SearchSetup.msi, and then click Install.

    If the System.Windows.Forms.dll file does not appear in the specified location on your computer, you receive the following message and the installation is not completed:System.Windows.Forms.dll file does not exist. Install the file and continue.
back to the top

REFERENCES

For additional information about the Orca Database Editor, click the following article number to view the article in the Microsoft Knowledge Base:

255905 HOWTO: Use the Orca Database Editor to Edit Windows Installer Files

For more information, visit the following Microsoft Developer Network (MSDN) Web site: back to the top


Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbSDK kbtable kbHOWTOmaster kbhowto kbPackage kbsetup kbDeployment KB827019 kbAudDeveloper