Monday, April 2, 2012

Create a Single Database deployment script from the dbproj in Visual Studio



  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 Build Output path, in this path single database deployment script will be created.
  9. Build your project to verify the script.


No comments:

Post a Comment