Out of the box support
The TeamCity alias, which returns an
ITeamCityProvider instance can be used to interact with the TeamCity environment.
The following example writes an error message if running on TeamCity:
if (BuildSystem.TeamCity.IsRunningOnTeamCity)
{
BuildSystem.TeamCity.WriteStatus(
"This is a error message.",
"error",
"Error details."
);
}
else
{
Information("Not running on TeamCity");
}
Running Cake
The recommended way to run the Cake .NET Tool on TeamCity is by using a tool manifest.
Add a command line build step with:
dotnet tool restore
dotnet cake
If you are using Cake.Sdk with a file-based script:
dotnet cake.cs
If you are using Cake.Sdk with a project:
dotnet run --project cake.csproj
If you are using Cake Frosting:
dotnet run --project cake.csproj
Available 3rd party extensions
Addin to enable code coverage reporting from an OpenCover result XML file to TeamCity