6.5 Project Properties and Conditions

   

It is often necessary for one stage of the installation process to pass information to a later stage. For example, the data collected from the user prior to installation usually needs to be available to the installation phase. To enable information to be exchanged, Windows Installer allows properties to be created and read. Some of these properties, such as Manufacturer and ProductName are set in the Properties window for the project. Others are determined at installation timeif you add a page to the installation user interface, all user input will be stored in named properties. For example, the Checkbox (A) page stores the user's selections in properties called CHECKBOXA1 , CHECKBOXA2 , CHECKBOXA3 and CHECKBOXA4 .

There is potential for ambiguity when talking about "properties." These properties made available by Windows Installer at install-time are distinct from the properties displayed in Visual Studio .NET's Properties windows.

To avoid ambiguity, the install-time properties will henceforth be referred to as installer properties .

These installer properties can be used in most places where a text string is required. If you enclose the installer property name in square brackets within a string, the value will be substituted at runtime. For example, the default installation location in a Windows application Setup project is [ProgramFilesFolder][Manufacturer]\[ProductName] . This will be expanded at runtime to the real path . (When the ProgramFilesFolder installer property is expanded, it ends in a backslash, which is why there is no slash between that and the Manufacturer property.)

Installer properties can also be used to control conditional aspects of installation. Most of the installable items (files, registry keys, custom actions, etc.) have a Condition property. By default, this is blank, meaning that the relevant item will always be installed. However, you can specify simple expressions in here, using installer properties set during earlier stages of installation.

For installer properties with a Boolean value, such as those representing checkboxes in the user interface, you can simply supply the name of the property as the Condition . If the properties have numeric values, you can use the normal comparison operators. (The supported operators are > , >= , < , <= , = = , and != .) For example, if an item's Condition was set to VersionNT>=501 , Windows Installer would install the item only on Windows XP or later versions of Windows. You can also compare string values with these operators.

   


Mastering Visual Studio. NET
Mastering Visual Studio .Net
ISBN: 0596003609
EAN: 2147483647
Year: 2005
Pages: 147

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net