.NET CLI (dotnet)
TeamCity comes with the built-in support of the .NET CLI toolchain providing .NET CLI (dotnet) build steps, CLI detection on the build agents, and autodiscovery of build steps in your repository.
This page provides details on configuring the .NET CLI (dotnet) runner. Also see the related blog post.
On this page:
- Requirements
- Build Runner Options
- Docker Settings
- Code Coverage
- Authentication in private NuGet Feeds
- Parameters Reported by Agent
Requirements
.NET Core SDK must be installed on your build agent machines.
TeamCity searches for the .NET executable files in the following order:
In the directory defined in the environment variable
DOTNET_HOME
for a TeamCity agent. For example,DOTNET_HOME=D:\SDK\dotnet\
.- In the default directory for the .NET executable file:
Windows:
C:\Program Files\dotnet
orC:\Program Files (x86)\dotnet
, or other default program files directory (depending on the environment variableProgramW6432
)Unix:
/usr/share/dotnet
Mac:
/usr/local/share/dotnet
In paths specified in the
PATH
environment variable.
TeamCity will use the first .NET version it finds. If you have several .NET versions installed, we recommend that you specify the most recent version in the DOTNET_HOME
variable.
Build Runner Options
Option | Description |
---|---|
Command | Select a
|
Projects | Specify paths to projects and solutions. Wildcards are supported. Parameter references are supported. If you have a finished build, you can use the file/directory chooser here. |
Working directory | Optional, set if differs from the checkout directory. Parameter references are supported. If you have a finished build, you can use the file/directory chooser here. |
Framework | Specify the target framework, for example, netcoreapp or netstandard. Parameter references are supported. |
Configuration | Specify the target configuration, for example, Release or Debug. Parameter references are supported. |
Runtime | Specify the target runtime. Parameter references are supported. |
Output directory | The directory where to place outputs. Parameter references are supported. If you have a finished build, you can use the file/directory selector here. |
Version suffix | Defines the value of the |
Command line parameters | Enter additional command line parameters for |
Logging verbosity | Select from the <Default>, Minimal, Normal, Detailed or Diagnostic. |
Docker Settings
Since TeamCity 2018.1, the .NET CLI build step can be run in a specified Docker container.
Code Coverage
JetBrains dotCover is supported as a coverage tool for the msbuild
, test
, and vstest
commands.
Authentication in private NuGet Feeds
TeamCity allows you to authenticate using private NuGet feeds. Read more in NuGet.
Parameters Reported by Agent
When starting, the build agent reports the following parameters:
Parameter | Description |
---|---|
| The .NET CLI version. |
| The path to .NET CLI executable. |
| The .NET Core SDK version. |