De-hardcoding and Variabilization

Often in our package, we have to reference directories, as well as existing or non-existing files in the package. Some references differ depending on the user logged on to the machine (for example the %appdata% folder). To sort this out, make the package more independent from fixed values, by using dynamic values. The solution is made with the help of dehardcoding and variability.

De-hardcoding

Hardcoding refers to references to various paths whether they belong to our application or not. It is solved by referring to the existing properties in our package.

References to a Directory:

  • [DirectoryNameInternal]
  • [$ComponentName]

File references:

  • long path [#FileName]
  • shortcut [! InternalNameFile]

References to system variables: [%SystemVariableName]Property References: [InternalNameProperty]

Variabilization

Variabilization refers to values that can be changed by the person installing the package, even at the time of installation. In such cases, public properties are defined with the initial values at the time of creating the package. They can be subsequently modified by the administrator, doing an installation from the command line.

As an example, let’s assume the property LICENSEKEY exists in the MSI. During installation, the administrator can install the package with the following command:

Msiexec /i [path to msi.msi] LICENSEKEY=11111-11111-11111 /qb