Customize Database Build and Deployment by Using Build and Deployment Contributors

Visual Studio 2010

Visual Studio provides extensibility points that you can use to modify the behavior of the build and deployment actions for database projects. These extension points are defined in such a way that they can apply to any database schema provider (DSP) implementation.

You can create an extension for the extensibility points, as shown in the following table:


Contributor Type




This type of extension is executed when the database project is built after the project model has been completely validated. The build contributor can access the completed model, in addition to all properties of the Build task and any custom arguments.



This type of extension is executed when the database project is deployed, as part of the deployment pipeline, after the deployment plan has been generated, but before the deployment plan is executed. You can use a DeploymentPlanModifier to modify the deployment plan by adding or removing steps. Deployment contributors can access the deployment plan, the comparison results, and the source and target models.



This type of extension is executed when the deployment plan is executed and provides read-only access to the deployment plan. The DeploymentPlanExectutor performs actions based on the deployment plan.

Supported Extensibility Scenarios

You can implement build or deployment contributors to enable the following example scenarios:

Generate schema documentation during a project build

To support this scenario, you implement a BuildContributor and override the OnExecute method to generate the schema documentation. You can override the OnPopulateArguments method to expose default arguments that control whether the extension runs and to specify the name of the output file.

Generate a difference report when a database project is deployed

To support this scenario, you implement a DeploymentPlanExecutor that generates the XML file when the database project is deployed.

Modify the deployment plan to change when data motion occurs

To support this scenario, you implement a DeploymentPlanModifier and iterate over the deployment play. For each SqlTableMigrationStep in that plan, you examine the comparison result to determine whether that step should be performed or skipped.

Copy files to the build output folder when a database project is deployed

To support this scenario, you implement a deployment contributor and override the OnEstablishDeploymentConfiguration method to specify which files that are marked as DeploymentConfigurationExtension (by the project system) should be copied to the output folder. You can also modify the contributor to merge multiple files into one new file that is copied to the output folder and is added to the deployment manifest.

In addition, you can expose customized pairs of name/value arguments from your contributor that are written to the database project file. You can use these arguments to enable the contributor to extract information from MSBuild or to enable the end user of your contributor to customize the behavior. For example, you could allow users to specify the name of an input or output file.

Common Tasks

Supporting Content

Learn more about the extensibility points: You can read about the base classes that you use to implement build and deployment contributors.

Create sample contributors: Learn the steps that are required to create a build or deployment contributor. If you follow these walkthroughs, you will:

  • Create a build contributor that generates a report that lists all elements in the model.

  • Create a deployment contributor that changes the deployment plan before it is executed.

  • Create a deployment contributor that generates a deployment report when you deploy a database project.

You can create all your contributors in a single assembly or among several assemblies, depending on how you want the contributors distributed to your team.

Distribute build and deployment contributors to team members: After you verify that your contributors work correctly, you can distribute them to your team. You can ask each team member to install and register the feature extension manually, or you can create a simple installation program for it.

Community Additions