The "Property" Command |
This command is used to create or update the value of a Windows Installer property.
If you wish to have the property set at a specific time (to capture the "current" value of properties etc) you should use the "PropertyCa" command instead.
This command takes these parameters:
As public properties can be overridden on the command line they are very useful for the setting up of default configuration values such as registry or INI settings and SQL connection (see the persist parameter). My recommendation is set up public properties to contain the correct values for production and then override as required for development, test installs etc.
You should use "*VALUE" if you have a VBSCRIPT expression which resolves to a string (use "cstr()" if you get a type mismatch).
Any MSI formatting will be left in place which is a major difference from the "PropertyCa" command.
While Windows Installer saves the location of directories which are overriden on the command line (or more likely used by a component), it does not do so for properties. Without persisting a configurable property any "repair" process will not work correctly as it will use the default value and not that selected at installation time!
Note that the exact value of the property (when "WriteRegistryValues" executed) is saved. If the property's value is a formatted value (such as "[INSTALLDIR]") then you should set it using the "PropertyCa" command.
If a macro of the form "PROPERTY_PERSIST_REGNAME_FOR_PRODUCT_PropertyName" exists then this holds the registry "name" (this defaults to the name of the property).
If a macro of the form "PROPERTY_PERSIST_REGNAME_FOR_VERSION_PropertyName" exists then this holds the registry "name" (this defaults to the name of the property).
A macro of the form "PROPERTY_PERSIST_SHARED_NameSpace_LOCATION" macro (or "PROPERTY_PERSIST_SHARED_ROOT_LOCATION" if the former doesn't exist) defines the registry location where the properties will be saved.
If a macro of the form "PROPERTY_PERSIST_REGNAME_FOR_SHARED_NameSpace_PropertyName" exists then this holds the registry "name" (this defaults to the name of the property).
The default for this parameter can be set via the DEFAULT_PROPERTY_PERSIST_HOW macro. This is initially "".
The default for this parameter can be set via the DEFAULT_PROPERTY_PERSIST_OPTIONS4COMPONENT macro. The initial value for this is "".
Main Property Related Options |
Please see the "options for commands" section of the manual.
#define? DEFAULT_PROPERTY_PERSIST_HOW ;;HK?? VERSION UI_REMOVE #define? PROPERTY_PERSIST_ROOT_LOCATION <$MAKEMSI_BASE_REGISTRY_KEY>\PersistingProperties #define? PROPERTY_PERSIST_PRODUCT_LOCATION <$PROPERTY_PERSIST_ROOT_LOCATION>\<$ProdInfo.Productname> #define? PROPERTY_PERSIST_PRODUCT_VERSION_LOCATION <$PROPERTY_PERSIST_PRODUCT_LOCATION>\<$ProductVersion> #define? PROPERTY_PERSIST_SHARED_ROOT_LOCATION <$PROPERTY_PERSIST_ROOT_LOCATION>\$Shared$ ;;You could redefine to include your company details (to ensure uniqueness) #define? PROPERTY_PERSIST_DOCUMENT_REGISTRY_IN_HTML N ;;Show in HTML report (Y/N)? #define? PROPERTY_PERSIST_COMPONENT_ATTRIBUTES LocalOnly #define? PROPERTY_PERSIST_COMPONENT_PERMANENT N ;;Do values survive an uninstall? (1) "N" = NO (2) "A" or "Y" = via "permanent" component attribute or (3) "G" = Don't register GUID (won't repair though) #define? DEFAULT_PROPERTY_PERSIST_OPTIONS4COMPONENT ;;Any options for autocreated components #define? PROPERTYCA_DEFAULT_TYPE_ATTRIBUTES ;;You'll probably never need to change...
EXAMPLE - Simple |
;--- Set a property --------------------------------------------------------- <$Property "ROOTDRIVE" VALUE="C:\"> ;--- Get "CustomField" from .VER product information ------------------------ <$Property "CustomField" VALUE="<$ProdInfo.CustomField>">
EXAMPLE - Remember Installation Directory |
If you main installation directory is "INSTALLDIR" and you wish to remember where a user may have redirected this for all future installs of your product then you can use code similar to the following:
;--- Define the installation directory -------------------------------------- <$DirectoryTree Key="INSTALLDIR" Dir="[ProgramFilesFolder]\<$ProdInfo.ProductName>" CHANGE="\" MAKE="Y"> ;--- Save/Restore the "INSTALLDIR" location --------------------------------- <$Property "INSTALLDIR" Persist="Y" PersistHow="PRODUCT FOREVER"> ;--- Example of using your own namespace ------------------------------------ <$Property "SharedProperty" Value="ItsShared" PERSIST="Y" PersistHow="LOCAL_MACHINE SHARED:MyCommon FOREVER">