Skip to content

Instantly share code, notes, and snippets.

@IndifferentDisdain
Created December 26, 2019 16:14
Show Gist options
  • Save IndifferentDisdain/f36f0aec8a2df8c89d69f04a52a3da6c to your computer and use it in GitHub Desktop.
Save IndifferentDisdain/f36f0aec8a2df8c89d69f04a52a3da6c to your computer and use it in GitHub Desktop.
Sample Azure Pipelines YAML build for ASP.NET Core web project and SQL Database project
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: VSBuild@1
displayName: 'Build Database Project'
inputs:
solution: '**\AzureResourceManagerDeploy.Database.sqlproj'
msbuildArgs: '/p:OutputPath=$(build.artifactstagingdirectory)'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: '--configuration $(BuildConfiguration)'
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: 'test'
arguments: '--configuration $(BuildConfiguration)'
projects: '**/*[Tt]ests/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment