0
votes

I am completely new to Azure DevOPs and CI in general and am trying to set up a simple proof of concept demo automated a build and release of a simple MVC application that has a SQL Server Database Project.

I am able to automate the build, but am struggling to understand how to access the DACPAC file from the Database Project to deploy the database from.

Currently I have a Visual Studio Build task that builds the solution which is then output to my drop directory, but I want to seperately build my database project and have the DACPAC file output into my final artifacts directory.

When my build task runs the following is output in the YAML:

SqlPrepareForRun:
Database -> d:\a\8\s\AzureDevOpsDemo1\Database\bin\Release\Database.dacpac

But its not accessible in the resulting build artifacts

What is the best way to achieve this?

1

1 Answers

2
votes

You have to do a CopyFile task that will copy the DACPAC file to the staging directory.

- task: CopyFiles@2
  displayName: 'Copy DACPAC files'
  inputs:
    SourceFolder: '$(System.DefaultWorkingDirectory)'
    Contents: 'Database/bin/$(BuildConfiguration)/*'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
    ArtifactName: drop