sql-server-data-toolssqlproj

Generate multiple DACPACs targeting multiple target platforms


I have an SSDT sql server database project of which I want to deploy to both an on premise SQL Server 2016 and SQL Azure.

It appears I can only set the project to target one platform Visual Studio sqlproj properties

I want to be able to build this project (using VSTS build agents) and get multiple DACPAC files, one for each targeted platform.

This question Visual Studio Database project target platform in publish profile may actually be the answer. However I have a feeling I may need the individual DACPACs for the deployment scenario.


Solution

  • Being that I'm using Visual Studio for the build, I can passed a properties argument to the command line

    /p:DSP=Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider
    

    which lets me control the Database Schema Provider at build time. Using this at a YAML azure pipeline looks like this:

            - task: VSBuild@1
              inputs:
                solution: '$(build.SourcesDirectory)\mydatabase\whoopie.sqlproj'
                vsVersion: 'latest'
                msbuildArgs: '/p:DSP=Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider'