Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.

Service Messages .NET library for

NuGet TeamCity.Dotnet.Integration License

This library provides read/write access to TeamCity Service messages. Take a look at the description of service messages at this page.


Most use cases are covered in tests.

To create service message, use:


To parse service messages, use:


There is an API to generate TeamCity specific service messages, use:


to get the instance of the object create an instance of the factory and get it by:

new JetBrains.TeamCity.ServiceMessages.Write.Special.TeamCityServiceMessages().CreateWriter()

for example:

// Creating the root writer
using (var writer = new TeamCityServiceMessages().CreateWriter(Console.WriteLine))
// Creating the build log block "Tests"
using (var block = writer.OpenBlock("Tests"))
// Creating the test suite "Tests"
using (var testClass = block.OpenTestSuite("TestClass"))
    // Creating the successful test
    using (var test = testClass.OpenTest("Successful"))
        test.WriteStdOutput("Some output");

    // Creating the ignored test
    using (var test = testClass.OpenTest("Ignored"))

    // Creating the failed test
    using (var test = testClass.OpenTest("Failed"))
        test.WriteFailed("Some message", "Details");

    // Attaching an image to test
    using (var test = testClass.OpenTest("Image"))
        writer.PublishArtifact(Path.GetFullPath("TeamCity.png") + " => TestData");
        test.WriteImage("TestData/TeamCity.png", "Team City Logo");

    // Attaching a value to test
    using (var test = testClass.OpenTest("Value"))
        test.WriteValue(1234.56.ToString(CultureInfo.InvariantCulture), "Some Value");

    // Attaching a file to test
    using (var test = testClass.OpenTest("File"))
        writer.PublishArtifact(Path.GetFullPath("TeamCity.png") + " => TestData");
        test.WriteFile("TestData/TeamCity.png", "Team City Logo file");

    // Attaching a link to test
    using (var test = testClass.OpenTest("Link"))
        test.WriteLink("", "JetBrains");