I have a SQL Server Database Project targeting a SQL Server 2012 RC0 database. The project was created in Visual Studio 2010 + SQL Server Data Tools CTP4. The project type is different than the regular Visual Studio 2010 database projects (it's the next version of SQL Developer Tools CTP3 Juneau).
It deploys fine in the IDE. How can I deploy it via the command line?
I tried VSDBCMD.exe but it expects a .deploymanifest file which is not created by the new project type.
If you are a masochist Microsoft also provide documentation on deploying the DACPAC via SMO, under the guise of 'using PowerShell'.
Of course you can call sqlpackage from PowerShell too...
Use sqlpackage.exe, located in
C:\Program Files\Microsoft SQL Server\{version}\DAC\bin
orC:\Program Files (x86)\Microsoft SQL Server\{version}\DAC\bin
where{version}
=110
(SQL Server 2012),120
(SQL Server 2014), etc.Command line arguments:
Example:
sqlpackage.exe /Action:Publish /SourceFile:C:\DbProject\bin\Debug\DbProject.dacpac /TargetServerName:localhost /TargetDatabaseName:TestDb
With target db details stored in a profile:
sqlpackage.exe /Action:Publish /SourceFile:C:\DbProject\bin\Debug\DbProject.dacpac /Profile:C:\DbProject\LocalDb.publish.xml
If you get the error "Unable to connect to target server" then make sure you are using the correct version of sqlpackage.exe (see here for more details).