Step 1: Initialize the Default Main Branch
Navigate to Azure DevOps:
Go to Azure DevOps and sign in with your credentials.
Select Your Project:
Choose Project1 from your list of projects.
Initialize theMain Branch:
Go to Repos > Files.
If the main branch does not exist, you will see an option to initialize it. Click on Initialize and follow the prompts to create the main branch1.
Step 2: Create a New Branch for the Pipeline
Navigate to Branches:
Go to Repos > Branches.
Click on New branch.
Create the Branch:
Enter azure-pipelines as the branch name.
Select main as the base branch.
Click Create2.
Step 3: Create a New Azure Pipelines YAML Pipeline
Navigate to Pipelines:
Go to Pipelines > New pipeline.
Select the Repository:
Choose Azure Repos Git and select the relevant repository.
Configure the Pipeline:
Select Starter pipeline.
Replace the default YAML with the ASP.NET template. You can find the ASP.NET template in the Azure Pipelines documentation oruse the following example:
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '5.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: |
dotnet build --configuration $(buildConfiguration)
displayName: 'Build project'
- script: |
dotnet test --no-build --configuration $(buildConfiguration)
displayName: 'Run tests'
Save the Pipeline:
Click on Save and enter azure-pipelines as the branch name.
Click on Save and run to save the pipeline to the new branch named azure-pipelines3.
By following these steps, you will have successfully initialized the main branch, created a new branch named azure-pipelines, and set up a new Azure Pipelines YAML pipeline using the ASP.NET template