CI for .NET
Build and test a .NET application using standard library tooling.
Use template →1steps:
2 - label: ":dotnet: Restore dependencies"
3 command: "dotnet restore --packages .nuget/packages"
4 key: "deps"
5 plugins:
6 - docker:
7 image: mcr.microsoft.com/dotnet/sdk:8.0
8 - artifacts:
9 upload: .nuget/packages
10 compressed: .nuget/packages.tgz
11 - artifacts:
12 upload: obj/*
13
14 - label: ":dotnet: Build"
15 command: "dotnet build --configuration Release --no-restore --property:EnforceCodeStyleInBuild=true"
16 depends_on: "deps"
17 plugins:
18 - artifacts:
19 download: .nuget/packages
20 compressed: .nuget/packages.tgz
21 - artifacts:
22 download: obj/*
23 - docker:
24 image: mcr.microsoft.com/dotnet/sdk:8.0
25
26 - label: ":dotnet: Run tests"
27 command: "dotnet test --no-restore --verbosity normal"
28 depends_on: "deps"
29 plugins:
30 - artifacts:
31 download: .nuget/packages
32 compressed: .nuget/packages.tgz
33 - artifacts:
34 download: obj/*
35 - docker:
36 image: mcr.microsoft.com/dotnet/sdk:8.0
- Languages
- C#
- Use cases
- Continuous integration, Web application
- Tools
- .NET
CI for .NET
This template provides a continuous integration (CI) pipeline that builds and tests a .NET application.
At a glance:
- For .NET applications
- Requires Docker
- Uses the .NET SDK CLI
How it works
This template:
- Restores project dependencies using
dotnet restore
and caches them for use across subsequent steps. - Builds the project using using
dotnet build
. - Runs unit tests using
dotnet test
.
The runtime environment uses the official .NET SDK Docker image with the latest version.
Next steps
After you select Use template, you’ll:
- Connect the Git repository for your .NET application.
- Configure the compute—run locally, on-premises, or in the cloud.
- Run the pipeline.
You can then play around with the pipeline settings. For example, run the pipeline locally while you iterate on the definition or set a schedule to trigger a nightly build.
If you need help, please check our documentation, raise an issue , or reach out to support.