This article discusses how to advertise a Microsoft Windows Installer (.msi) package. This article contains an example that demonstrates how to advertise a Windows Installer file that you create by using Microsoft Visual Studio .NET.
The Windows Installer file includes a Windows application and a text file. You can advertise the features in the Windows Installer file only by using the command-line option of the Msiexec executable program. Additionally, you must use the ADVERTISE property to advertise the features. This article discusses the following two ways to advertise the features:
Advertise all features
Advertise only some features
If you want to advertise only some features, you must modify the Windows Installer file by using the Orca database editor.
Windows Installer can advertise the availability of an
application without installing the application. If an application is
advertised, only the interfaces that are required for loading and for starting
the application are presented. If you start the advertised interface, Windows
Installer installs the required components. This method is also referred to as installation-on-demand.
Advertising is applied to each feature of an
application. When an application is advertised, the application appears to have
been installed. The Start menu contains the appropriate shortcuts, files on
your computer are associated with the application, and registry entries on your
computer reflect the application's installation. However, the application is
not installed until the first time that you try to start it.
When you
create a Windows Installer file by using Visual Studio .NET, you do not have
the option to designate that your package is to be advertised. You can
advertise the package only by using a command-line option during the
installation. At the command prompt, you can explicitly list the features that
you want to advertise or you can advertise all the features.
To
explicitly list the features, you must use a command that is similar to the
following:
If you include the ADVERTISE property in the Property
table of the Windows Installer file and then set the value to ALL, the
advertised package cannot be installed or removed.
Create a Windows Installer file by using Visual Studio .NET
Start Visual Studio .NET.
On the File menu, point to
New, and then click Project. The New
Project dialog box appears.
Under Project Types, click Setup
and Deployment Projects.
Under Templates, click Setup
Project.
In the Location box, type
C:\Setup.
In the Name box, type
MySetup, and then click OK.
Add the Windows application to the Setup project, and then
add a shortcut to the Programs menu. To do this, follow these steps:
In Solution Explorer, right-click
MySetup, point to Add, and then click
File. The Add Files dialog box
appears.
In the Add Files dialog box, locate
and then double-click the MyWinApp folder on your
computer.
In the MyWinApp folder, double-click
the bin folder.
In the Add Files dialog box, click the
MyWinApp.exe file, and then click
Open.
In the left pane of the File System editor, click
User's Programs Menu, right-click the blank space in the right
pane, and then click Create New Shortcut. The Select
Item in Project dialog box appears.
In the Select Item in Project dialog
box, double-click Application Folder.
Click MyWinApp.exe, and then click
OK.
Add the text file to the Setup project, and then add a
shortcut to the Programs menu. To do this, follow these steps:
In Solution Explorer, right-click
MySetup, point to Add, and then click
File. The Add Files dialog box
appears.
In the Add Files dialog box, locate
and then click the MyText file on your computer. Click
Open.
In the left pane of the File System editor, click
User's Programs Menu, right-click the blank space in the right
pane, and then click Create New Shortcut. The Select
Item in Project dialog box appears.
In the Select Item in Project dialog
box, double-click Application Folder.
To advertise the features explicitly, you first must modify the
Windows Installer file by using the Orca database editor. Microsoft provides
the Orca database editor to edit your Windows Installer file. The Orca database
editor is included with the Microsoft Windows Installer Software Development
Kit (SDK).
To explicitly list the features in the ADVERTISE property,
you first must define the features in the Feature table. The ADVERTISE property
can only use the features in the Feature column of the Feature table. You must
modify all the tables in the Windows Installer file that contain the Feature
column. To do this, use the Orca database editor to modify the
FeatureComponents table, the MsiAssembly table, the Feature table, and the
Shortcut table.
After you have modified the Windows Installer file,
you can use the list of features that are defined in the Feature table to
specify the features that you want to advertise. To advertise the features that
you want that appear in the Feature table, add them to the ADVERTISE
property.
Install the Orca database editor by double-clicking
the Orca.msi file in the InstalledPath\Bin folder.
Note InstalledPath is a placeholder for the
path of the location where the Windows Installer SDK is installed.
Click Start, point to
Programs, and then click Orca.
On the File menu, click
Open.
In the Open dialog box, locate and
then click the MySetup.msi file that you created in the
"Create a Windows Installer file by using Visual Studio .NET" section. Click
Open. The tables in the MySetup.msi file are listed in the
left pane.
Modify the tables in the MySetup.msi file:
In the left pane, click the
FeatureComponents table.
In the Feature column, replace the two existing values
with the following values:
Feature1 Feature2
In the left pane, click the Feature
table.
Replace the existing value in the Feature column with
the following value:
Feature1
On the Tables menu, click Add
Row to add a row to the Feature table. The Add Row
dialog box appears.
In the Feature - String[38], Required
box, type Feature2.
Click Display, and then type
2 in the Display - Short
box.
Click Level, and then type
1 in the Level - Short, Required
box.
Click Directory, and then type
TARGETDIR in the Directory_ - String[72]
box.
Click Attributes, and then type
0 in the Attributes - Short, Required
box.
In the Add Row dialog box, click
OK.
In the left pane, click the
MsiAssembly table.
In the right pane, change the value in the Feature
column to the value that corresponds to the existing component. The correct
value for the existing component appears in the Feature column of the
FeatureComponents table.
In the left pane, click the Shortcut
table.
In the right pane, change the values in the Target
column to the values that correspond to the existing components. The correct
values for the existing component appear in the Feature column of the
FeatureComponents table.
Advertise the features explicitly by using the ADVERTISE
property
To advertise the features explicitly, the list of features that
you want to advertise must follow the ADVERTISE property. To do this, follow
these steps.
Note Use commas to separate the feature names.
Click Start, click Run,
type cmd in the Open box, and then
click OK.
At the command prompt, use one of the following commands to
advertise the features:
To advertise only one feature, type one of the
following commands:
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.