I wonder why you add your INSERT data SQL as post-publish scripts? I guess it's fine for creating development databases but what happens when you deploy to production?
Thank you Jakob! I like how many of you are finding out the dots I left out :)
So yes, Script.PostDeployment.sql is a script used to populate a brand new database. In order to solve what you mentioned we use different configurations, besides "Debug" and "Release" we created a "deployDB" configuration.
We manually edit the sqlproj file to indicate we want to include Script.PostDeployment.sql only when the configuration is "deployDB".
In the CI instead of executing msbuild in "Release" we call it in "deployDB" mode "/p:Configuration=deployDB"
You could also do that to publish to production. You can create another configuration called, lets say "publishToProd", create your own PROD.PostDeployment.sql and there setup all the scripts you want to be executed when you publish that to prod.
I think this deserves another post :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Darío.
Nice write-up :)
I wonder why you add your INSERT data SQL as post-publish scripts? I guess it's fine for creating development databases but what happens when you deploy to production?
Thank you Jakob! I like how many of you are finding out the dots I left out :)
So yes, Script.PostDeployment.sql is a script used to populate a brand new database. In order to solve what you mentioned we use different configurations, besides "Debug" and "Release" we created a "deployDB" configuration.
We manually edit the sqlproj file to indicate we want to include Script.PostDeployment.sql only when the configuration is "deployDB".
In the CI instead of executing msbuild in "Release" we call it in "deployDB" mode "/p:Configuration=deployDB"
You could also do that to publish to production. You can create another configuration called, lets say "publishToProd", create your own PROD.PostDeployment.sql and there setup all the scripts you want to be executed when you publish that to prod.
I think this deserves another post :)