Deploy VS Database Projects workaround

Posted on: Tue May 18 12:27:06 -0700 2010. Updated on: Tue May 18 12:27:06 -0700 2010.
Category: DotNet

I like using the Visual Studio Database Projects to keep track of my databases in a particular project. The thing is, when deploying a brand new database, using it can be a bit not cool because there is no Deploy button. You have to go into the project properties, change the deploy action to actually push to the database, then you have to make sure the connection to the database works, and if you're using source control, you probably do not want to check in a build that deploys to the database every time.

So the workaround is:
1. Right click the project, and hit deploy, of course without pushing to the DB.
2. Look at the output window in VS at the bottom, and copy the location of the deploy script generated
3. Open up SQL Server management studio and hit File -> Open File and paste in the path.
4. Be sure you are in the right DB instance, and now you'll need to do some text replacing. Replace $(DatabaseName) in the whole document for you db name.
5. Then delete the lines of code at the top that have the colen :
6. Now hit run

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.