net_prog
net_prog

Reputation: 10251

How to specify database for Database Project and deploy?

I created a Database Project in VS 2012, but how do I specify a database connection for it so that it uses the database context for Intellisense tips and for deployment?

Also, to deploy to the target database, have I call Publish all the time, or can it be done on each build?

Upvotes: 0

Views: 746

Answers (1)

joerage
joerage

Reputation: 4923

Intellisense does not use a connection string to function, it uses the objects (table, views, column, etc) defined in your project.

For deployment, this is done through publishing. You can right-click your project and select Publish... and this will open the Publish Database popup. From there, you use profiles to deploy to the right database with the correct settings.

Once you have profiles created, they will appear as file in your project, you can then double-click those and then publish your database using that profile.

As for publishing each time you build the project, I never tried it, but this can probably be accomplished by changing the targets your project use building. By default, your project looks like this:

<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">

Try changing this to

<Project DefaultTargets="Build;Publish"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">

Upvotes: 2

Related Questions