1

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:

  • I can't find the way how to build project with SqlPackage
  • I can't find the way how to pass variables to MSBuild

What I can now:

  • I can build the project using MSBuild
  • I can generate the publish script with SqlPackage

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Ohh, I didn't think about the thing that variables values are not stored in the dacpac ... thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.