System Properties of a Build Configuration
Last modified: 20 April 2023Various build configuration settings can be defined by referencing Build Configuration Properties. Build Configuration Properties are either user-defined or predefined.
In this section:
Defining Properties
The system properties and environment variables required for a build configuration can be defined in three locations. Where these properties and variables are set will determine whether they affect a specific build configuration, all of a project's build configurations that use the same VCS root, or a specific Build Agent.
To define properties specific to a build configuration, enter them on the Build Configuration's 6.Properties and environment variables page.
To define properties for all of a project's build configurations that use the same VCS root, create a text file named
teamcity.default.properties
, and check it into the VCS root. Ensure the file appears directly in the build working directory by specifying appropriate Configuring VCS Settings. The name and path to the file can be customized via theteamcity.default.properties
property of a build configuration. Properties defined this way will not be visible in the TeamCity web UI, but will be passed directly to the build process.To define agent-specific properties edit the Build Agent's
buildAgent.properties
file (<agent home>/conf/buildAgent.properties
). (see agent below)note
Note that properties and variables entered on the build configuration's page take priority and will supersede the values entered in the
teamcity.default.properties
andbuildAgent.properties
files. Likewise values set in thebuildAgent.properties
file will supersede values set in theteamcity.default.properties
.note
Default build properties loaded from
teamcity.default.properties
are logged into the agent's log, but not to the build log.The system properties and environment variables are defined in the
teamcity.default.properties
andbuildAgent.properties
files using the following format:[env|system].property_name=property_value For example: env.CATALINA_HOME=C:\tomcat_6.0.13
env. properties define the environment variables used during the process of running the build. These consist of the environment variables of the agent running the build, the environment variables defined in the agent configuration and the TeamCity default properties files and the environment variables set for the build configuration on the 6.Properties and environment variables page when you Creating and Editing Build Configurations. Please note that the agent's environment variables can vary depending upon which user the agent process is running. The list of environment variables available on a specific build agent can be found on the Environment variables tab of the Agent Details page .
system. properties include the properties defined on the 6.Properties and environment variables page in build configuration area of TeamCity, agent-specific predefined properties as well as system properties defined in the agent configuration file.
Referencing Properties
On the build configuration administration screens the properties can be referenced by %system.<property name>%
and %env.<property name>%
. Only the properties defined on agent and in the build configuration itself can be referenced.
Any user-defined property can reference other properties by using the following format:
%[env|system].property_name% For example: system.tomcat.libs=%env.CATALINA_HOME%/lib/*.jar
An exception to this is the teamcity.build.checkoutDir, which is referenced as is, without prefixes.
Any Global and system property (system.*) can be referenced in a build script by the property name:
For Ant and NAnt use ${<property name>}
For MSBuild (Visual Studio 2005/2008 Project Files) use $(<property name>)
note
Don't forget to leave the "system." part out of the system properties.
note
When using MSBuild, remember to replace "." with "_" when you reference property names.
Any user-defined environment variable is passed to the environment of the build agent that will process the build and can be used there as a usual environment variable.
Any property that is referenced in a build configuration, but is not defined, becomes a Agent Requirements for the configuration. The build configuration will be run only on agents that have this property defined.
Predefined Properties
Global
These properties can be used for setting various build configuration settings and inside build scripts.
Property Name | Value |
---|---|
teamcity.build.checkoutDir | working folder where the build is started |
build.number | build number assigned by TeamCity |
build.vcs.number.XX | VCS changelist number, where XX is the number of VCS root (1, 2, etc.) Use build.vcs.number.1 if only one VCS root is configured for a project
|
For a full list of supported properties please refer to the 6.Properties and environment variables section of Build Configuration settings in TeamCity Web UI.
Agent-specific
Agent-specific properties are defined on each build agent and vary depending on its environment. Aside from standard properties (for example os.name
or os.arch
, etc. — these are provided by JVM running on agent) agents also have properties based on installed applications. TeamCity automatically detects a number of applications including the presence of .NET Framework, Visual Studio, and TeamCity NUnitLauncher utility and adds the corresponding system properties and environment variables. (A complete list of predefined properties is provided in tablePredefinedProperties and listOfPredefinedProperties below). If additional applications/libraries are available in the environment, the administrator can manually define the property in the buildAgent.properties
file (<agent home>/conf/buildAgent.properties
). These properties can be used for setting various build configuration options, for defining build configuration requirements (e.g. existence or lack of some property) and inside build scripts. For more information on how to reference these properties see ref above.
Predefined Property | Description |
---|---|
agent.name | Name of the agent as specified in the |
DotNetFramework<version>[_x86|_x64] | This property is defined if the corresponding version(s) of .NET Framework is installed |
DotNetFramework<version>[_x86|_x64]_Path | This property's value is set to the corresponding framework version(s) path(s) |
DotNetFrameworkSDK<version>[_x86|_x64] | This property is defined if the corresponding version(s) of .NET Framework SDK is installed |
DotNetFrameworkSDK<version>[_x86|_x64]_Path | This property's value is the path of the corresponding framework SDK version |
WindowsSDK<version> | This property is defined if the corresponding version of Windows SDK is installed. Version can be either 6.0 or 6.0A |
VS[2003|2005|2008] | This property is defined if the corresponding version(s) of Visual Studio is installed |
VS[2003|2005|2008]_Path | This property's value is the path to the directory that contains |
teamcity.dotnet.nunitlauncher<version> | This property's value is the path to the directory that contains the standalone NUnit test launcher, |
teamcity.dotnet.nunitlauncher.msbuild.task | The property's value is the path to the directory that contains the MSBuild task dll providing the NUnit task for MSBuild, sln2005, or sln2008. |
tip
Please note:
Make sure to replace "." with "_" when using properties in MSBuild scripts. That is use
teamcity_dotnet_nunitlauncher_msbuild_task
instead ofteamcity.dotnet.nunitlauncher.msbuild.task
_x86 and _x64 property suffixes are used to designate the specific version of the framework.
teamcity.dotnet.nunitlauncher
properties can not be hidden or disabled.
Here is the complete list of supported predefined properties:
DotNetFramework1.0,
DotNetFramework1.0_Path,
DotNetFramework1.0_x86,
DotNetFramework1.0_x86_Path,
DotNetFramework1.1,
DotNetFramework1.1_Path,
DotNetFramework1.1_x86,
DotNetFramework1.1_x86_Path,
DotNetFramework2.0,
DotNetFramework2.0_Path,
DotNetFramework2.0_x86,
DotNetFramework2.0_x86_Path,
DotNetFramework2.0_x64,
DotNetFramework2.0_x64_Path,
DotNetFramework2.0_x86,
DotNetFramework2.0_x86_Path,
DotNetFrameworkSDK1.0,
DotNetFrameworkSDK1.1,
DotNetFrameworkSDK1.1_Path,
DotNetFrameworkSDK1.1_x86,
DotNetFrameworkSDK1.1_x86_Path,
DotNetFrameworkSDK2.0,
DotNetFrameworkSDK2.0_Path,
DotNetFrameworkSDK2.0_x86,
DotNetFrameworkSDK2.0_x86_Path
VS2003
VS2003_Path
VS2005
VS2005_Path
VS2008
VS2008_Path
You can disable the autodetection of these predefined properties by editing the buildAgent.properties
file and adding the disableDotNetDetection property. Please note that this property is case-sensitive.
This property can have the following values:
Value | Description |
---|---|
empty string | All versions of .NET Framework will be detected and added to the Agent's properties |
'*' | All existing versions of .NET Framework will not be detected and thus not included in the Agent's Properties |
version number(s) (Values should be separated by commas) | Excludes versions of .NET Framework starting with that number |
'windowsSDK6.0' or 'w' | Excludes Windows SDK 6.0 |
VS<X> | Excludes Visual Studio version <X>, where <X> can be 2003, 2005, 2008 or left blank to exclude all existing versions of Visual Studio |
Examples | Description |
| Excludes .NET Framework 3.0, 3.5 and all other versions starting with 3 |
| Excludes .NET Framework versions 1.1 and 2.0 |
| Excludes Windows SDK 6.0, .NET Framework 2.0 and Visual Studio 2003 |
tip
Please refer to the Agent Details page of the TeamCity web UI to view a particular Build Agent's properties.
Thanks for your feedback!