How to deploy a Database Project with Team Build 2010

Problem:

I need to deploy a database project during a Team Build.

Solution:

Edit the dbproj file to include the Deploy target.

Explanation:

  1. Open the solution that contains the desired database project. 
  2. Right click on the database project and select properties. 
  3. Click the Deploy tab and verify the Deploy Action is set to "Create a deployment script (.sql) and deploy to the database, and the Target Database Settings are correct. 
  4. Now we need to update the .dbproj file to include the Deploy target.  From the Solution Explorer right click the database project and select "Unload Project". 
  5. Right click on the database project and select "Edit [database].dbproj" where [database] equals the name of your database project. This will open the .dbproj with an XML editor. 
  6. Update the DefaultTargets attribute of the Project element to "Build;Deploy". 
  7. Save and close the file then right click the database project and select "Reload Project". 
  8. Check in your database project.
  9. Queue your build. Your database will be built and deployed.
Comments are closed