Contents
How to create database deployment in Visual Studio 2010?
To create an environment-specific configuration file In Visual Studio 2010, in the Solution Explorer window, right-click your database project, and then click Properties. On the database project properties page, on the Deploy tab, in the Deployment configuration file row, click New.
When to use pre deployment and post deployment scripts?
Pre-deployment and post-deployment scripts execute Transact-SQL statements before and after the main deployment script, which is generated from the database project. A project can have only one pre-deployment and one post-deployment script. These scripts can be used for many purposes. For example:
How to use SQLCMD in post deployment script?
You can use SQLCMD syntax to reference a variable in the post-deployment script. You set the SQLCMD variable in the project properties or in a publish profile: For more information on using SQLCMD in scripts see Database Project Settings.
When do I need to deploy the database properties?
Deploy database properties. This lets you choose whether to apply the database properties, as defined in the Database.sqlsettings file. When you deploy a database for the first time, you should deploy the database properties.
How to deploy a database to multiple environments?
To support the deployment of a database project to multiple destinations, you should create a deployment configuration file for each target environment. In Visual Studio 2010, in the Solution Explorer window, right-click your database project, and then click Properties.
Is it possible to deploy from Visual Studio to different machines?
Yes, you can deploy from Visual Studio to different machines. You can also do it from the command line, using VSDBCMD. And you can create a WIX project to give a wizard for others to install it with. If you can connect to the target database from your dev PC, you can deploy to it.
How to import and deploy a database in vsdbcmd?
The /a (or /Action) switch specifies what you want VSDBCMD to do. You can set this to Import or Deploy. The Import option is used to generate a .dbschema file from an existing database, and the Deploy option is used to deploy a .dbschema file to a target database.