Deploy VS Database Projects workaround
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