- Code: Select all
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
& "C:\\Program Files (x86)\\Microsoft SQL Server\\110\\DAC\\bin\\SqlPackage.exe" /sf:$path"\\bin\\Release\\MyProject.Database.dacpac" /a:publish /TargetConnectionString:$DBConnectionString /p:VerifyDeployment=true /p:CreateNewDatabase=$CreateNewDatabase | Out-Default
You will need to add a CreateNewDatabase variable so database can be recreated depending on the environment.. eg. Development re-creates DB but not production
There is a lot more options available as well..
http://msdn.microsoft.com/en-us/library ... 03%29.aspx
This is definitely not perfect, as I want to make it a bit more flexible on the paths, but it works great on my environment