Continuous deployment
.NET Core CICD Continuous Deployment Continuous Integration DevOps TeamCity Visual Studio

How to Configure a Build for a .NET Core Project with TeamCity

Welcome to today’s post.

I will show how to create a build configuration that integrates your .NET Core Application for build, test and release pipelines with the TeamCity Continuous Integration / Continuous Deployment Tool.

Assuming you have already downloaded and installed the TeamCity tool.

The current version I am using for this post is TeamCity 2018 (there has since been a 2019 release).

Open TeamCity (the URL might be something like http://localhost:8080).  In the landing page, click on the Administration menu item.

Under Project related settings click on the Projects link.

Click on Create Project.

Next, select the location of the source repository.

If you are referencing a GitHub repository, then either the From a repository URL or From are equally valid methods to integrate.

I will admit it have tried the From option and had some issues with the URL opening GitHub. If I can find the workaround for this then I will re-post this with both alternatives. I will show how to link by the repository URL:

If we are linking to a repository in GitHub, then the URL will be of one of the forms:

Branch TypeURL Format
GitHub Repository URL Types

After entering the URL and credentials click Proceed.

The next screen will confirm the integration of your GitHub project and TeamCity. Build steps will also be auto-detected:

You may wish to select which steps to keep for these build steps:

Below are the steps selected into the build pipeline:

Next, you will need to install the version of NUnit Console that corresponds to the NUnit 3 Test Adapter of your NUnit Test project.

First, open Administration and click on Tools under Integrations:

After clicking Install Tool.. select NUnit Console and Add from the dialog:

The next dialog shows requiring selection of the NUnit Console version:

To decide which version to use, open the csproj file of your Unit Test project and look for the Version key value of the PackageReference corresponding to NUnit3TestAdapter

In this case as shown, it is 3.10.0. (It may vary for your installation).

After selecting the version, click Add:

The NUnit Console will then be installed:

The next task you will need to do is amend the checkout if you plan to use a branch instead of the master branch.

Click on Version Control Settings.

In the checkout rules, click on Edit:

In the checkout screen edit the VCS root name, VCS root ID, and Default branch (the Fetch URL is defaulted and should be the same unless you are targeting a different repository).

The VCS root name will be of the format:[account-name]/[repository-name]#refs/heads/master


depending on whether you choose to integrate with the master branch or a feature branch.

The VCS root ID can be generated by clicking on Regenerate ID. (The VCS root ID is of the format:

[Repository-Name] _HttpsGithubCom[Account-Name][Repository-Name]RefsHeadsMaster


[Repository-Name] _HttpsGithubCom[Account-Name][Repository-Name]Tree[Branch-Name]

The Default branch is the branch that will be checked out by TeamCity. It will be of the format:




Once the VCS settings are saved. Test the connection:

Then save the settings.

The updated VCS root will show in the checkout rules:

Next, if you attempt to run the build and get an incompatible agent issue with the MSBuild version missing as shown: 

You will need to add a new MSBuild requirement to support the build.

Click on Add new requirement. Select the latest MSBuild version in the list. Usually, for Visual Studio 2017, the MSBuild is at least version 15: 

Next, open the build step for Visual Studio (sln):

Select the Visual Studio corresponding to the edition installed on the same machine / server that your TeamCity installation is installed.

In my case, I use Visual Studio 2017.

After saving, click on Run..

The build commences:

After a while, the build completes.

If successful, you will see a Build finished and no red errors in the previous steps:

That’s all for today’s post.

I hope you found it useful and informative.

In a future post I will show how to add NUnitTest steps to your build release pipeline.

Social media & sharing icons powered by UltimatelySocial