Microsoft KB Archive/827019

= HOW TO: Use AppSearch in a Windows Installation Package =

Article ID: 827019

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Windows Installer 2.0
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Platform Software Development Kit-January 2000 Edition

-



IN THIS TASK

 * SUMMARY
 * Requirements
 * Create a Windows Installer Package by Using Microsoft Visual Studio .NET
 * Open the Microsoft Windows Installer (.msi) File by Using the Orca Editor
 * Add New Tables to the .msi File
 * Create the Signature Table
 * Create the AppSearch Table
 * Create the DrLocator Table
 * Create the LaunchCondition Table
 * Verify That the Application Works
 * REFERENCES



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:  Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project. Under Project Types, click Visual Basic Projects. Under Templates, click Windows Application, and then click OK. Add a Button control to Form1.  Add the following code to the Button1_Click event handler: MessageBox.Show(&quot;This is a test Windows Installation package&quot;)  On the Build menu, click Build Solution.</li> On the File menu, point to Add Project, and then click New Project.</li> Under Project Types, click Setup and Deployment Projects.</li> Under Templates, click Setup Project.</li> In the Name text box, type SearchSetup, and then click OK.</li> In Solution Explorer, right-click SearchSetup, point to Add, and then click Project Output.</li> In the Add Project Output Group dialog box, click OK.</li> In Solution Explorer, right-click SearchSetup, and then click Build.</li></ol>

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: <ol> Start Orca.

Note To download and then install Platform SDK (including Orca), visit the following Microsoft Web site:

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

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.</li> On the File menu, click Open.</li> In the Open dialog box, locate the SearchSetup.msi file (located in the SearchSetup\Debug folder).</li> Click the SearchSetup.msi file, and then click Open.</li></ol>

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: <ol> 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.</li> On the Tables menu, click Add Table.</li> In the Add Tables dialog box, click to select the following check boxes: <ul> Signature</li> LaunchCondition</li> <li>AppSearch</li> <li>DrLocator</li></ul>

Click OK.</li></ol>

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  \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
<ol> <li>Locate the SearchSetup.msi file (located in the SearchSetup\Debug folder) on your computer.</li> <li>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.

</li></ol>

back to the top

<div class="references_section">