Saturday, March 26, 2022

Azure Pipeline with Azure Repos and Github

 Azure Pipeline can be configured with Azure Repos and Github as well.

Azure Pipeline with Azure Repos

Step 1: Click on the Azure Pipeline and Create a pipeline

Step 2: Select the Repo as your Code Repo.

Step 3: Select the framework as Asp.Net Core.

Step 4: Use the default pipeline code 


trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Step 5: Save the code in the default azure-pipeline.yml file and commit the code in the master branch.

Step 6: The pipeline should be created and executed successfully.


Azure Pipeline with Azure Repos

Step 1: Click on the Azure Pipeline and Create a pipeline

Step 2: Select the Repo as Github YAML and  Provide Github Authorization to accept the Azure pipeline to access your Code Repo.

Step 3: Select the framework as Asp.Net Core.

Step 4: Use the default pipeline code 


trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Step 5: Save the code in the default azure-pipeline.yml file and commit the code in the master branch.

Step 6: The pipeline should be created and executed successfully.





0 comments:

Post a Comment