This demo will step through importing a repository from GitHub and creating a pipeline in Azure DevOps for the project. The pipeline will build, test & publish a NuGet package for usage by other projects.
- Repos will be the source control for our code.
- Pipelines will build and release our code.
- Artifacts will enable us to share our package.
This demo assumes you have a DevOps organization. If you don’t, you can create one easily enough.
FixedWidth is the project we’ll be working with throughout this demo. FixedWidth is a .NET library I created a few years back for deserializing and serializing fixed width text from message queues.
Go to your DevOps dashboard and create a new project named “FixedWidth”.
You should now have an empty project.
Go to Repos and navigate to Files. This is where our source will reside. Click Import to import a repository.
https://github.com/mscribellito/FixedWidth.git for Clone URL.
You will see the files from GitHub once the import is complete.
Go to Artifacts and create a new feed. This is where our NuGet package will be published. Click on Create Feed.
Type “FixedWidth” and click Create.
Go to Pipelines and create a new pipeline. This is where we will configure the build process.
Create Base Pipeline
Click on Create Pipeline.
Connect: Choose Azure Repos Git.
Select: Choose the FixedWidth repo.
Configure: Choose .NET Desktop.
You will see the YAML pipeline definition generated.
Save and run the pipeline.
You should now see the pipeline running. Click on Job to see the tasks.
You can click on the individual tasks to see their log.
View Unit Tests
Go to Test Plans and navigate to Runs. This is where you can see the summary and results of the unit tests executed as part of the pipeline.
The summary tab will show you high level details of the runs.
Results tab will provide a more detailed view at the individual test level.
Add NuGet Tasks
Go to Pipelines and edit the FixedWidth pipeline. This is where we will create and publish the package. Add NuGet pack task. Provide
**/FixedWidth.csproj for Path to csproj and
TargetFramework=net452 for Additional build properties.
Add NuGet push task. Select FixedWidth for Target feed.
The tail of azure-pipelines.yml should now resemble this. Save the pipeline.
The pipeline will be automatically triggered. You should see the 2 additional NuGet tasks now.
Go to Artifacts. This is where we can see our package created by the pipeline.
Select FixedWidth and click Download.
You can open fixedwidth.2.0.0.nupkg with NuGet Package Explorer and verify the contents. It’s now ready to be used by other projects.