Problem:
I need to deploy a database project during a Team Build.
Solution:
Edit the dbproj file to include the Deploy target.
Explanation:
- Open the solution that contains the desired database project.
- Right click on the database project and select properties.
- 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.
- 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".
- 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.
- Update the DefaultTargets attribute of the Project element to "Build;Deploy".
- Save and close the file then right click the database project and select "Reload Project".
- Check in your database project.
- Queue your build. Your database will be built and deployed.