With Visual Studio Database Projects you could use VSDBCMD.EXE to deploy your database project using the Post-build event command line in your project properties.
[caption id="attachment_410" align="alignnone" width="701"]
So, I needed to figure out how to do this with SQL Projects as my build was failing miserably doing the way you would with Database Projects. The docs on MSDN tell you how to publish a database project using the 'Publish Database' dialog (like one-click publish). Although this method works its not ideal in situations were you want to automate your publish on build to satisfy some dependencies, or if your lazy and don't want to right-click and deploy each time ;) Unfortunately, I couldn't find how to automate the publishing of the database. After reading sqlzapper's post I realized that I needed to use SQLPACKAGE.EXE to publish my database in the Post-build event command line instead of VSDBCMD.EXE.
[caption id="attachment_411" align="alignnone" width="701"]
You can find more information on SQLPACKAGE.EXE commands at http://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx.
I just showed you how to deploy your database using the Post-build command line. Looking at the images there is a lot to be explained, such as the new tabs in the project properties and .dbschema file extension from the database project vs. the .dacpac file extension from the SQL database project (in the Post-build event scripts). Check out sqlzapper's post and the other links I provided above to learn more about them.
No comments:
Post a Comment