Question

I recently had a PC failure and reinstalled the Windows OS and all my development software. After re-installation, my Visual Studio 2012 Database Projects seems to work differently and I cannot figure it out. My database projects no longer "automatically deploys" to the LocalDB when I press F5 or CTRL+F5. I am using VS2012 Professional version with the default installation settings.

On my old installation, if I changed a column name in the project and pressed F5, the table in LocalDB would be updated immediately without any sort of publishing actions or anything. The Visual Studio output window would also indicate that changes are being applied. This "automatic deployment" is no longer happening, I have to resort to right clicking on the project & clicking publish, which works, but is inconvenient.

What can I do to re-enable this "auto deployment" feature?

So far, I tried:

  • I looked thru every database related setting in Tools > Options.
  • I confirmed the Configuration Manager is set to both "Build" and "Deploy" for my database projects.
  • I confirmed that the LocalDB is installed and working.
  • I applied all Windows updates & updated VS2012 to the latest version, 2012v4.
  • I tried all combinations of Clean, Build and Rebuild at the project & solution level.
  • I checked "Always Re-create Database", and even this doesn't work.

I suspect that this feature might be dependent upon other software or patches that I had on my old installation.

Was it helpful?

Solution

I figured this one out myself.

There is an option that controls how dependent projects are built under the "Projects and Solutions > Build and Run" section. I overlooked this option at first, but eventually came back around to it when I was testing each setting one at a time.

The description of the check box might be incomplete or perhaps I'm just misunderstanding it. This setting appears that it does not affect the build action of the database project, but it does affect the deploy action. When this is checked, my database project, which is not the startup project builds but does not deploy on Run/Debug. When this is unchecked, my database project builds and deploys as I expect with no additional steps required.

Image of mentioned Visual Studio options

OTHER TIPS

I found two alternatives from the accepted answer:

  1. Right-click the solution, select "Startup Project", "Multiple startup projects", and make the database project one of them.

  2. Right-click the solution, select "Project Dependencies", and make the database project a dependency on one of the other projects that will be built.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top