What you’ll learn
- Map Jenkins concepts to Azure Pipelines.
- Run the same C# CI flow on a hosted agent.
- Publish a Pipeline Artifact.
When you’re finished
- Run the C# demo in Azure Pipelines.
- Compare its artifact and logs with Jenkins.
Reuse the same jenkins-csharp-demo application.
6.1 Map Jenkins concepts to Azure Pipelines
| Jenkins | Azure Pipelines |
|---|---|
| Jenkinsfile | azure-pipelines.yml |
| Agent | Agent |
| Stage | Stage |
| Steps | Steps/tasks |
| Archived artifact | Pipeline artifact |
| Credentials | Variables / secret variables / service connections |
The important learning goal is to notice how much of the mental model transfers.
6.2 Build the C# demo
Add azure-pipelines.yml at the repository root.
Core flow:
stages:
- stage: BuildAndTest
jobs:
- job: Build
steps:
- checkout: self
- powershell: dotnet restore JenkinsCSharpDemo.sln
- powershell: dotnet build JenkinsCSharpDemo.sln --configuration Release --no-restore
- powershell: dotnet test JenkinsCSharpDemo.sln --configuration Release --no-build
Use a Windows agent image for the Windows-oriented demo.
The complete file is in Appendix D.
6.3 Publish the artifact
Publish to a predictable staging directory, then publish that directory as a pipeline artifact.
Conceptually:
dotnet publish
↓
artifact staging directory
↓
Azure Pipeline artifact
After the run:
- Open the Azure DevOps pipeline run.
- Verify all steps passed.
- Open the artifact.
- Download it.
- Compare it with the Jenkins artifact from Chapter 3.
The application is unchanged. Only the pipeline engine changed.