I have been working with MVC5 and Entity Framework 6 for the past few months. I have separated my main models/business logic and "Migrations" to a separate assembly and referenced it in my web application. Migrations have been working just fine.
Today I ran "Update-database" and I get "No connection string named 'DefaultConnection' could be found in the application config file."
The 'DefaultConnection' is STILL in my web.config file. If I copy the section to the project where the Migrations are located, it works again. If I remove the section, it throws that error. I don't know what might have changed.
The only thing I did since yesterday was run "Disk Cleanup" to clear up space on my HD.
Okay. After some obscure Google searches I found the answer. Apparently my project containing the Migration code was set as the "Startup Project".
After resetting my web application as the Startup Project (and making sure the 'Default Project' in the Package Manager is set to my Migrations project), it started working again!
Problem solved!
Make sure that the execution of a command from Nuget console you choose the right project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With