March 21st, 2006

Formatting Properties

Heath Stewart
Principal Software Engineer

A frequently asked question is about why property values in the Property table aren’t formatted when the values contain properties themselves, such as:

[ProductName] is copyright by [Manufacturer].

The reason these property values aren’t formatted is because the Value column type is simply Text, not Formatted. Other formattable column types exist, including Template and Condition types. Since properties can be included in formattable strings, the Property table does not allow formattable values because it could create a circular reference, such as with the following example archive file format:

Property    Value
s72 l0
Property    Property
A   [B]
B   [A]

Your own custom actions or external UI handler can format these properties, however, using the MsiFormatRecord function. To avoid circular references, format only private properties and make sure those properties are not authored to contain circular references such as those in the example above. Windows Installer provides some protection as documented in the Property table, but take care to not workaround this protection,

Note that you cannot use the Property table to set a property to the value of another property. The installer does nothing to the text string entered in the Value column before setting the property in the Property column. If FirstProperty is entered into the Property column and [SecondProperty] in the Value column, the value of FirstProperty is set to the text string “[SecondProperty]” and not to the value of the SecondProperty property. This is necessary to prevent creating circular references in the Property table. Instead, you can set one property to another by using a Custom Action Type 51.

Author

Heath Stewart
Principal Software Engineer

Heath is an application architect and developer, looking to help educate others to learn professional development. Besides designing and developing applications he enjoys writing about intermediate and advanced topics. Heath also consults for deployment packages and scenarios within Microsoft and for external customers.

0 comments

Discussion are closed.