The properties of a Build Configuration can be used:
Also, predefined Agent Properties are used in the 7.Agent Requirements.
The properties fall into two categories:
- environment variables - defined in the corresponding section of the Build Configuration settings. Within TeamCity the properties that correspond to the environment variables have names starting with "env." prefix.
- system properties - defined in the corresponding section of the Build Configuration settings. Names start with "system." prefix.
Using Properties in the build
The properties are passed to the build as environment variables and as system properties of the build script.
Any runner gets the environment variables that are a combined set of:
- environment variables of the Build Agent process itself
- env.* properties defined in the agent's
- env.* properties defined in the Build Configuration
- env.* properties redefined in the Run Custom Build dialog
- pre-defined environment variables
- env.* properties that came from
env. prefix is trimmed from the properties before passing them into environment.
Scripts run with Ant, NAnt, MSBuild runners get properties from a combined set of:
- system.* properties defined in the agent's
- system.* properties defined in the Build Configuration
- system.* properties redefined in the Run Custom Build dialog
- pre-defined system properties
- system.* properties that came from
system. prefix is trimmed from the properties before passing them into the build script.
Any system property (
system.<property name>) can be referenced in a build script by the property name:
- For Ant and NAnt use
- For MSBuild (Visual Studio 2005/2008 Project Files) use
Using Properties in Build Configuration Settings
Many settings of a build configuration allow to use a reference to the Build Configuration properties. Before being passed into a build, all the references will be resolved with the available properties. If there will be references that cannot be resolved, they will be left as is and a warning will be logged into the build log.
The properties should be referenced as
system.<property_name> for system properties and
env.<variable_name> for environment variable.
Values of the following settings support references:
The references are made by enclosing the full property name including
env./system. prefixes into percentage signs.
Any user-defined property can reference other properties by using the following format:
Any property that is referenced in a build configuration, but is not defined, becomes an agent requirement for the configuration. The build configuration will be run only on agents that have this property defined.
Using Properties in VCS Labeling Pattern and Build Number
In Build number pattern and VCS labeling pattern you can use
%[env|system].property_name% syntax to reference the properties that are known on the server-side. These are server and reference predefined properties and properties defined in the settings of the build configuration on Properties and environment variables page.