EF Database Migrations–No Connection String

Sometimes things don’t work the way you would expect them to or how they worked in the past.  Entity Framework is one of those things that frustrates me when it goes wrong…

I had created a simple database migration in a class library and could not figure out why I kept getting a

System.InvalidOperationException: No connection string named ‘OperationsDatabase’ could be found in the application config file.

I had the connection string defined in the app.config and built the library but no luck.  And I selected the default project in the package manager console.  Simple enough in the end after stumbling upon this post.

update-database –startupprojectname “myclasslibrary”

This entry was posted in C#, Entity Framework. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *