EngineeringNov 30, 20214 min read

Continuous integration for .NET applications

Jacob Schmitt

Senior Technical Content Marketing Manager

2021-11-19-CICD-dotNET

.NET is a popular open source, cross-platform development framework for building fast and scalable full-stack applications for the web, desktop, mobile, and the cloud. This flexibility makes .NET a leading platform for developing enterprise web applications and makes .NET development one of the most in-demand skills on the market.

High performing .NET teams can accelerate their development cycles and ship code more consistently and reliably by adopting DevOps principles and a mature, dedicated continuous integration platform. With CircleCI’s native Windows support, you can automate the build, test, and deploy stages of your .NET development workflow to go from concept to production quickly and securely.

Windows support is included in CircleCI’s free plan, so teams and individual developers can take advantage of the efficiency gains that continuous integration provides.

Building .NET projects on CircleCI

CircleCI’s support for .NET development starts with the Windows execution environment.

The Windows executor provides powerful, customizable build orchestration using dedicated virtual machines for every job and includes all the tools you need to build and test your .NET applications, including:

  • Windows Server 2019
  • Visual Studio 2019
  • .NET 5
  • .NET Core SDK

You also get access to three shells for running jobs in your Windows environment—PowerShell, Bash, and CMD—that you can use to SSH into your Windows VM and troubleshoot failed pipelines.

Teams who want to build on private infrastructure can use runners with the machine executor and a Windows image. For even more flexibility in your execution environment, you can run Docker containers on the Windows executor. You can also avoid using the Windows executor entirely by running your .NET Core applications, SQL Server, and other dependencies in a Linux container on the Docker executor.

For a simple demonstration of how you can use the Windows executor to build your .NET projects, check out Hello World on Windows.

You can learn more about building with the Windows executor by watching John Hammond’s Getting started with Windows on CircleCI video tutorial.

Configuring a continuous integration pipeline for .NET with orbs

Orbs are pre-packaged bits of CircleCI YAML that you can use in your pipeline configuration file to reduce complexity and share commands, executors, and job specifications across projects.

Using the Windows orb, you can invoke the Windows executor, set the size of the Windows resource you want to use, and start using Windows elements in your .NET development workflows and jobs with just a few lines of code.

Adding the Windows orb to your pipeline is as straightforward as including the following lines in your config.yml file:

orbs:
  win: circleci/windows@2.4

You can extend the functionality of your pipeline by including additional orbs in your configuration file. For example, you can use the MSIX orb to build your .NET desktop applications as signed MSIX packages.

Game developers can use the third-party Unity orb to build Unity projects and store build logs and artifacts after the build completes. For more information on building Unity projects with CircleCI, see Continuous integration for Unity using CircleCI.

Building, testing, and deploying .NET applications in a CI/CD pipeline

With a continuous integration pipeline set up, you can automatically build and test your .NET applications every time a change is committed to your code.

For example, you can use the Windows orb to build and test an ASP.NET Core web application. With the Windows execution environment, you can use the dotnet.exe test command to automatically run unit tests on your code, allowing you to quickly identify and fix issues before they reach your users.

You can also configure your pipeline to automatically deploy .NET web applications to a variety of hosting environments. Once your application passes all the tests you have set up, you can deploy your application to any number of hosting platforms.

You can use the Heroku orb to deploy an ASP.NET Core app to Heroku or the Azure CLI orb to deploy an ASP.NET Core app to an Azure Web App service. Automating your deployments will eliminate manual approval steps and save your development team significant time and energy.

Start building .NET on CircleCI for free

Automating .NET development workflows with a full-featured CI/CD platform makes teams faster and more resilient. The right tools give developers more opportunity to innovate and deliver value to users quickly and continuously. With CircleCI’s first-class support for .NET development, including upcoming updates for the new .NET 6 and Visual Studio 2022 releases, you can be confident in choosing CircleCI as your team’s long-term home for continuous integration and delivery.

To learn more about how CircleCI can help you build, test, and deploy your .NET applications with speed and confidence, sign up for a free CircleCI account today.

Copy to clipboard