Build and Deploy CI/CD pipeline for .net Application using Azure DevOps

·

2 min read

Cover Image for Build and Deploy CI/CD pipeline for .net Application using Azure DevOps

In this project we will build and deploy CI/CD pipeline for .net Application using Azure DevOps.

Create a Project in Azure DevOps First create a project in Azure DevOps.

Push source Code into Azure Repo I pushed .Net Source Code into Azure DevOps Repo. This Repo is part of Microsoft Parts Unlimited Open Source Project.

GitHUb link for Parts Unlimited Project

Build a Pipeline for the application Create a new pipeline in Pipelines

Select Azure Repo as source Repo

select starter pipeline in configure your pipeline

for our pipeline let's add tasks. This tasks will create artifact. task will download required libraries for the application. build the project and create a artifact. first task is Nuget. Nuget is used to download libraries for .net Application.

Second task is we need Visual studio to build the project. I will add Build commands needed for this project below.

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true 
/p:PackageLocation="$(build.stagingDirectory)" /p:IncludeServerNameInBuildInfo=True /p:GenerateBuildInfoConfigFile=true 
/p:BuildSymbolStorePath="$(SymbolPath)" /p:ReferencePath="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsft\Pex"

copy the files to the agent source folder and publish artifact to the staging directory.

Now click on save and run. this will run the build pipeline and create a artifact.

create a release pipeline. click on release and select new release pipeline.

now just like build pipeline we need to add tasks to the release pipeline.

Add ARM Template as task as we need to create the environment for our app.

add varaibles to the pipeline. In the process we are passing some variables to the pipeline.

add App service deployment as task. we will deploy our web app into a app service plan

release pipeline ran sucessfully.

App has been deployed sucessfully.

let's test our pipeline I will change the display name from

<h1>Priya Abilash</h1> <h2>avani subsidiary</h2> ``` to ``` <h1>Sydney Auto Parts</h1> <h2>avani subsidiary</h2>

we have pipeline build so new artifact will be created and we can manually deploy the release pipeline.

![](https://github.com/AbiVavilala/CI-CD-Pipeline-for-.Net-application/blob/main/images/test1.png)

you can see build pipeline is running once we save the changes to the layout.cshtml file in our repo

let's create a new release for new build Click on edit pipeline and add the new build artifact as new artifact

The pipeline is running.

Pipeline ran succesfuly.

I will refresh the browser and see the changes made to the repo.