I'm trying to set SQLCmd variables based on configuration (Debug / Release, etc) but the Configuration dropdown is greyed out (see image below). For Dev environment, I want the SQLCmd variable to be Stage, for the Release environment, Prod.
I can't figure out an easy way to do this without going into the properties. We have 9 projects and about 6 variables each. Each time we do a schema comparison we have to manually change the variables and it's very tedious.
Our publish scripts are fine for the different environments, it's just setting up for schema compare that makes it time-consuming.
1 Answers
Answers 1
down vote accepted UPDATE
I've now discovered that the if/else syntax above doesn't work for me because some of my linked scripts require a GO statement. Essentially the :r just imports the scripts inline, so this becomes invalid sytax.
If you need a GO statement in the linked scripts (as I do) then there isn't any easy way around this, I ended up creating several post deployment scripts and then changing my project to overwrite the main post depeployment script at build time depending on the build configuration. This is now doing what I need, but it seems like there should be an easier way!
So in my project I have the following post deployment files:
1) Script.PostDeployment.sql (empty file which will be replaced) 2) Default.Script.PostDeployment.sql (links to scripts needed for standard data config) 3) Configuration1.Script.PostDeployment.sql (links to scripts needed for a specific data config)
0 comments:
Post a Comment