Share via


How to: Deploy Changes using Team Foundation Build

You can build and deploy your database in Visual Studio by using MSBuild or Team Foundation Build. If you want to build and deploy your database project in a build lab environment, use Team Foundation Build. To use Team Foundation Build, you must have a computer on which it is installed. For more information, see Building the Application.

Typically, you will use Team Foundation Build only to deploy to a development, test, or staging server, and not to a production or preproduction environment.

The process to deploy changes by using Team Foundation Build is as follows:

  • Define a custom workflow that can deploy a database by using VSDBCMD.EXE

  • Create a build definition.

  • Use the new build definition to deploy your database project.

Team Foundation Build in Visual Studio 2010 uses Windows Workflow 4.0 to orchestrate the build process. To deploy a database by using Team Foundation Build, you must create a custom workflow. That workflow will deploy the output of your build if your build succeeds and if your tests pass or if you have no tests. For more information, see Walkthrough: Define a Custom Workflow to Deploy a Database from Team Foundation Build.

In addition, before you can deploy changes by using Team Foundation Build, you must:

  • Have a database project with its properties set.

  • Check in the database project to version control.

Create a Build Definition

To create a build definition

  1. In Team Explorer, click your team project, right-click the Builds node, and click New Build Definition.

    The New Build Definition window appears.

  2. In Build definition name, type the name that you want to use for the build definition.

  3. In the list of categories, click Trigger and specify what action will be taken when you check in changes to the files for the database project.

    For more information, see Create a Basic Build Definition.

  4. In the list of categories, click Workspace and specify the source control folders that you want to include in this build.

    Important

    All files in the specified folders must be copied to the build server for each build. Include only those folders that are required by this database project or solution. If you chose a Continuous Integration, Rolling builds, or Gated Check-in build trigger, when files that are contained in the specified folders are checked in, a build might be triggered. If you specified the root folder of your version control server, you would synchronize all files and all check-ins would potentially trigger a build. This setting can have a significant impact on build performance.

  5. In the list of categories, click Build Defaults.

  6. In Copy build output to the following drop folder (UNC path, such as \\server\share), specify a folder to contain the build output.

    You can specify a shared folder on your local computer or on any network location to which the build process will have permissions.

  7. In the list of categories, click Process.

  8. In Build process template, click Show details.

  9. In Build process file (Windows Workflow XAML), click the build process file that you created to deploy the database project. For more information about how to create that custom workflow, see Walkthrough: Define a Custom Workflow to Deploy a Database from Team Foundation Build.

    Important

    You must use a custom workflow to deploy a database directly by using Team Foundation Build. You can also deploy the database indirectly when you run database unit tests. For more information, see How to: Run Database Unit Tests from Team Foundation Build.

  10. In the Build Process Parameters list, click in the Items to Build property, and then click the browse (…) button to specify the version control path to the database project or solution that you want to build.

  11. (Optional) In the list of categories, click Retention Policy to specify how builds should be retained.

    Note

    For more information about how to create a build definition, see Create a Basic Build Definition.

  12. On the File menu, click Save ProjectName.

    You have created a build definition, which you will run in the next procedure to deploy the database project.

Deploy your Database

You have now configured the build definition and set up the database project for use with Team Foundation Build. You can perform a test build to verify whether your database deploys successfully.

To deploy your database

  1. In Team Explorer, expand the Builds folder, right-click the build definition that you created to deploy the database project, and then click Queue New Build.

    The Queue Build dialog box appears.

  2. Confirm that the values in the Build definition, Build controller, and Drop folder for this Build fields are all appropriate, and then click Queue.

    In Build Explorer, the Queued tab appears. For more information, see Manage and View Completed Builds.

See Also

Tasks

How to: Configure Build Settings for Database and Server Projects

How to: Configure Deployment Settings for Database and Server Projects

How to: Run Database Unit Tests from Team Foundation Build

Concepts

Build and Deploy Databases to an Isolated Development Environment

An Overview of Database Build and Deployment

Building the Application