Skip to content

Instantly share code, notes, and snippets.

@FrankDeGroot
Created October 6, 2025 13:11
Show Gist options
  • Select an option

  • Save FrankDeGroot/f7726105dbe81059dcdd4deb6ddda123 to your computer and use it in GitHub Desktop.

Select an option

Save FrankDeGroot/f7726105dbe81059dcdd4deb6ddda123 to your computer and use it in GitHub Desktop.
jobs:
- job: Build
variables:
# Make it easier to cache packages (see labs)
# https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages/
steps:
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: restore
workingDirectory: $(Build.SourcesDirectory)/TodoItems.Api
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: ef
arguments:
migrations script
--output $(Build.ArtifactStagingDirectory)/SQL/db.sql
--idempotent
--project TodoItems.Api.csproj
--context TodoDb
--no-build
--verbose
--configuration Release
workingDirectory: $(Build.SourcesDirectory)/TodoItems.Api
env:
# Ensure migration script is not created against the in-memory database.
ASPNETCORE_ENVIRONMENT: DUMMY
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: false
projects: '**/TodoItems.Api.csproj'
arguments:
--no-restore
--configuration Release
--nologo
--no-build
--output $(Build.ArtifactStagingDirectory)/todoItemsApi
modifyOutputPath: false
zipAfterPublish: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment