TeamCity .NET Continuous Integration

With full support for the .NET toolchain, TeamCity provides a complete CI/CD solution for your .NET projects. No matter which version of the .NET Framework you’re using, and whether you’re building with Visual Studio’s Devenv, MSBuild, .NET CLI, or using many different tools at once, TeamCity provides a consistent and reliable platform for continuous integration, delivery, and deployment.

.NET build management

To get started with .NET CI/CD, all you need to do is to connect TeamCity to a version control system and wait while it scans your project. TeamCity will automatically find your solution files, understand how the project is structured, and suggest the steps required to build it. TeamCity’s powerful .NET build runner supports all platforms, all versions of .NET SDKs, and all modern and legacy build tools.

.NET automated testing

Rapid feedback from your automated tests is an essential element of continuous integration and delivery. TeamCity provides native support for key .NET testing frameworks, including NUnit, MSTest, xUnit, Gallio, and MSpec, ensuring real-time test results are delivered to your VCS hosting platform and the TeamCity UI.

Built-in NuGet package management

It’s easy to keep track of project dependencies and manage access to your .NET packages with TeamCity’s NuGet integration and support for public and private NuGet feeds. TeamCity can automatically restore required NuGet packages as part of your build steps, publish packages and build artifacts to external NuGet feeds, and even act as a NuGet Server itself.

Continuous integration tools for .NET

The unified .NET build runner in TeamCity handles the vast majority of .NET build, test, and publish tasks, streamlining your build configurations while maintaining the flexibility to meet every use case. The runner supports:

  • .NET CLI commands.
  • Windows and cross-platform MSBuild.
  • “True” Visual Studio IDE (devenv).
  • Windows and cross-platform tests, including NUnit and XUnit.
  • Launching Windows, .NET processes, and command scripts on different operating systems.
  • Code coverage with NCover, PartCover, and dotCover.
  • Logging levels and other parameters.

The .NET build step can run in a Docker container independently of the host operating system, allowing you to streamline your CI/CD processes and accelerate your development workflow. For the full technical details, please see the .NET section of our documentation.

Ready to level up your .NET continuous integration?

No matter the size of your development team, we have a solution for you. Choose TeamCity On-Premises if you want to be able to fine-tune every aspect of your delivery pipelines, or TeamCity Cloud if you need a managed, cloud-hosted service.

Automating builds and tests using C# Script Runner

TeamCity’s C# Script Runner is the ideal solution for .NET developers looking for a way to set up build, test, and delivery jobs using their favorite language. It lets you automate a variety of routine tasks related to your CI/CD pipelines, such as environment setup, OS user management, build status notifications, and more.

C# Script Runner works on Windows, Linux, and macOS and can run inside a Docker container. Inside its configuration script, you can reference build parameters, environmental variables, and system properties. The runner can access public feeds, private feeds, and TeamCity’s internal NuGet feeds, and automatically restore NuGet packages.

Scaling CI/CD infrastructure for your .NET projects

As one of the leading platforms for creating web and mobile apps, cloud services, and desktop applications, .NET is used by many game studios and large enterprises. Regardless of the size and complexity of your projects and regardless of the load your team creates during peak times, TeamCity never keeps you waiting. It can dynamically increase the capacity of your CI/CD infrastructure by spinning up new build agents in the cloud, eliminating the build queue and reducing the overall build time.

Autoscaling is available for a variety of cloud platforms, including Amazon EC2, Microsoft Azure, Google Cloud, VMWare vSphere, Kubernetes, and others. TeamCity can also monitor the performance of build agents, making sure that you are always using the optimal amount of resources for your pipelines.

Configuring CI/CD pipelines for .NET

Version control systems support

Regardless of how the source code of your .NET projects is organized, TeamCity can build it. Our solution seamlessly integrates with all popular version control systems, including Git, Perforce, Mercurial, Subversion, Team Foundation (TFVC), and more. Whether your code is stored in a monorepo or distributed across multiple VCSs, hosted in the cloud or on-premises, it provides a unified approach for working with all types of repositories, allowing you to focus on developing great apps rather than writing your own VCS management scripts.

Learn more about TeamCity’s version control system integrations.

Issue trackers support

TeamCity not only shortens the feedback loop, but also helps your team collaborate more effectively in general. By integrating with issue tracking systems, it lets you trace issues back to specific commits, builds, and deployments, allowing for a more streamlined and efficient development workflow. TeamCity has a wide range of integrations available, including popular issue tracking systems such as Jira, Azure DevOps, YouTrack, GitHub, GitLab, Bitbucket Cloud, and many others.

Automatic pipeline optimizations

TeamCity automatically detects the most efficient build agents, calculates optimal task ordering, reuses artifacts that have not been changed, allows distributing tests across multiple build agents to run in parallel, and performs many other pipeline optimizations to help you detect bugs earlier and speed up your release process.

FAQ: Continuous integration for .NET apps with TeamCity

Can I build .NET apps with the free version of TeamCity?

Yes, the .NET build runner is a free feature that is available in all versions of TeamCity, including the free self-hosted version, TeamCity Professional. In TeamCity Cloud, you can use it for free during the 14-day trial period. The same licensing policy applies to all other related features, including the C# Script Runner and NuGet integration.

Why are the build runners that I used for .NET earlier shown as deprecated?

The legacy MSBuild, Visual Studio (sln), Visual Studio 2003, and Visual Studio Tests build runners are no longer supported and only remain for compatibility reasons. To get the most current support for .NET continuous integration, please migrate to the new unified .NET build runner.

Can TeamCity run .NET builds in a Docker container?

Yes, TeamCity allows you to choose between running builds directly on build agents and running them in Docker. It allows you to customize Docker commands using build parameters, use templates to set up pipelines in a centralized manner, automate the removal of obsolete Docker images from build agents and registries, and much more.

What other programming languages does TeamCity support?

TeamCity is a general-purpose CI/CD solution that supports all programming languages and integrates with all popular tools used for building and testing software. In addition to the .NET build runner, it has specialized runners for Gradle, Maven, Node.js, Python, Kotlin, and other technologies. Custom build scripts can be run using the generic Command Line runner.