Dmitrij Kultasev
Dmitrij Kultasev

Reputation: 5787

Build and generate script for SSDT project using command line tools

I am trying to achieve following workflow using command line:

  1. Build the project using specific variables overriding via command line (for example I have $(buildVersion) variable in publish config that has some value. I would like to override the $(buildVersion) by entered value command line. The output of this step is dacpac file
  2. Generate the publish script based on the generated dacpac file and the actual database

I tried to use both SqlPackage.exe and MSBuild.exe tools. However I can't get desired effect as:

What I can now:

Upvotes: 1

Views: 2581

Answers (1)

Gavin Campbell
Gavin Campbell

Reputation: 826

The stuff in a publish profile for a database project doesn't affect the build step where the dacpac is created, after all you can have as many publish profiles as you like for a single project.

When generating the publish script with sqlpackage.exe, you can pass variables like sqlpackage.exe /action:script /sourcefile:mydacpac.dacpac /v:BuildNumber=xyz

Upvotes: 3

Related Questions