Property List and Properties

The optional property list section allows for the definition and assignment of variables (called “properties”) that may be used later in the configuration file. Property definitions defined in this section are referred to as “internal” properties.

<!-- define expandable properties -->
<!-- optional -->
<propertylist>
 <property name="projectname" value="myproject"/>
 <property name="projectdir" value="c:\myprojects"/>
</propertylist>

Variables (“property references”) may also be used in the configuration file without being defined in this section. For example they may be defined on the command line or come from the environment.

Properties work via string substitution, using the following algorithm to find a value associated with the property:

  1. Check the external property list for a value.
  2. If not found, check for an environment variable with the same name as the property,
  3. If not found, check for an internal definition in the propertylist section of the configuration file,
  4. If still not found, use the empty string as the value.

External properties are passed in on the command line using the –p option. There are three built-in external properties:

  • “applicationdir”, which reflects Dotfuscator’s installation directory.
  • “appdatadir”, which reflects Dotfuscator’s local data directory.
  • “configdir”, which reflects the directory in which the configuration file resides.

Properties are useful for creating configuration files that act as templates for multiple projects, or for different versions of the same project, or for simple portability across different build environments.

A property is referenced with the following syntax:

${property_name}

Property references are case sensitive, so ${MyProjectDir} references a different property than does ${myprojectdir}.

Property references may not be used just anywhere in the configuration file. Currently, property references may only be used as values in the “dir” or “name” attributes of the <file> element. Here is a list of sections that use the <file> element:

inputassembly mapinput mapoutput
output tempdir assembly
removalreport transform key
loadpaths program filelist

A property reference will be interpreted literally in any other place in the configuration file.

Property references may not be nested. Nesting them will result in an error.

Here is an example of a property reference in use:

<output> 
 <file dir="${testdir}\output"/>
</output>

© 2002-2007 PreEmptive Solutions. All rights reserved.