How to restore Deploy parameter: (only Visual Studio 2010/2012 - this is no longer supported in Visual Studio 2013)
The Deploy option is still present, but for some reason it is not available in the menu. (Cursed Visual Studio Team!) I worked on this by adding the Expand option to one of the toolbars as follows:
- Click the arrow on the right side of the toolbar.
- Click Add or Remove Buttons, then choose Customize.
- In the Preferences dialog box, click Add Command.
- Select the Create category, then select the Expand Selection command.
- After saving your choice, the option "Expand [project name]" will appear on the toolbar. You will need to select your project in Solution Explorer for the button to turn on.
Note that deployment options are different from publishing settings. Deployment options are configured in the project properties on the Debug tab.
To answer your questions about the Publish option:
1) How to use a specific default publication file and avoid annoying prompts
I donβt think there is a way around this.
2) How to publish the entire database, not just changes
Open the .publish.xml file in a text editor and add <AlwaysCreateNewDatabase>true</AlwaysCreateNewDatabase> .
For example:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TargetDatabaseName>MyDatabase</TargetDatabaseName> <DeployScriptFileName>MyDatabaseProject.sql</DeployScriptFileName> <TargetConnectionString>Data Source=localhost\SQL2012;Integrated Security=True;Pooling=False</TargetConnectionString> <PublishDependentProjects>False</PublishDependentProjects> <ProfileVersionNumber>1</ProfileVersionNumber> <AlwaysCreateNewDatabase>true</AlwaysCreateNewDatabase> </PropertyGroup> </Project>
3) Command line syntax for automated builds
First create your project using msbuild, as usual, so that the .dacpac file is created in the trash.
Then use sqlpackage.exe to publish using the .publish.xml file:
C:\Program Files\Microsoft Visual Studio 10.0\Microsoft SQL Server Data Tools\sqlpackage.exe /Action:Publish /SourceFile:C:\[path to my project]\bin\Debug\MyDatabaseProject.dacpac /Profile:C:\[path to my project]\MyDatabaseProject.publish.xml
Please note that the path to sqlpackage.exe may be different.
Keith
source share