Udostępnij za pośrednictwem


How to: Configure Properties for Deployment Details

When you configure the deployment settings for your database project, you specify a file that contains properties that control the details of deployment. These properties control how the deployment occurs, instead of what is being deployed. For example, you can control whether you deploy database properties together with the schema, whether the database is always re-created, and whether the database is backed up as part of the deployment process. You can also configure advanced settings that control the deployment script, determine whether certain types of differences are ignored, and let you specify how errors should be handled. For more information about these settings, see An Overview of Database Project Settings. You can share a properties file between multiple build and deployment configurations, or you can customize the settings for each target deployment.

Note

The default values for deployment options differ from the default Schema Compare options in several areas. By default, operational settings, such as fill factor and index padding, are included in Schema Compare but ignored when you deploy.

To specify details that control deployment

  1. Perform one of the following steps:

    • In Solution Explorer, expand your database project, expand the Properties node, and click the .deploymentconfig file that you want to modify. Open the View menu, and click Open.

    • Open the properties for your database project, and click the Deploy tab. In Deployment configuration file, click the file that contains the details that you want to modify, and then click Edit. For more information, see How to: Configure Deployment Settings for Database and Server Projects.

    The deployment configuration details appear.

  2. In the Deployment comparison collation list, perform one of the following steps:

    • Click Use the collation of my project to use the collation of the database project (the source model) when comparing models when you deploy the project.

    • Click Use the collation of the server to use the collation of the target database (the target model) when comparing models when you deploy the project.

  3. Select the Deploy database properties check box to deploy changes to database properties when you deploy the project. Otherwise, clear the check box.

  4. Select the Always re-create database check box to drop and re-create the database when you deploy the database project. Clear the check box if you want to deploy updates to the schema.

    Important

    If you want to preserve the data that is contained in the tables in your database, you must clear this check box.

  5. Select the Block incremental deployment if data loss might occur check box to stop deploying updates if they would cause potential data loss. Clear the check box if deployment should continue regardless of data loss. If the Always re-create database check box is selected, this check box is ignored.

    Note

    When you deploy changes that include common refactoring operations (such as renaming an object or moving an object to a different schema), the refactoring log file helps preserve the intent of your changes. For more information, see Refactoring Database Objects in a Team Environment.

  6. Select the Execute deployment script in single-user mode check box to put the database into single-user mode when you deploy the database. Otherwise, clear this check box.

  7. Select the Back up database before deployment check box to back up the database when you deploy the project. Clear this check box if you prefer to back up the database separately from the deployment process.

  8. Select the Generate DROP statements for objects that are in the target database but that are not in the database project check box to remove objects from the target database if they are not defined in that project when you deploy it. Otherwise, clear this check box.

  9. Select the Do not use ALTER ASSEMBLY statements to update CLR types check box if you want the object that instantiates the common language run-time (CLR) type to be dropped and re-created when you deploy changes. Otherwise, clear this check box and the assembly will be altered, if possible.

  10. On the File menu, click Save FileName**.sqldeployment**, where FileName is the name of the deployment file that you are modifying.

See Also

Tasks

Walkthrough: Create and Deploy a New Version-Controlled Database

Walkthrough: Deploy Changes to an Existing Version-Controlled Database

Walkthrough: Creating an Isolated Database Development Environment

Concepts

Build and Deploy Databases to an Isolated Development Environment

Build and Deploy Databases to a Staging or Production Environment

An Overview of Database Build and Deployment