I had to re-create a VM for Rock development and when I moved my existing rock codebase to the new VM Visual Studio was throwing an exception when trying to run the debug build.

It was complaining about being unable to connect to the database. I used the server explorer tab in the solution to verify that the connection to the database server was logging in OK, it just couldn't find the Rock database.

This was because I did not bring my previous rock database over to the new VM (there was nothing of value there). I was assuming that Rock would automatically create a new / empty db the first time I ran it on the new VM but this was not happening.

The solution

The fix is to create an empty file named ~/App_Data/Run.Migration

Global.asax.cs has a trigger that if it finds that file it will run migrations .

Once migrations have been run remove the file.

This solved my problem. Thank you Mark Lee.