0

My ASP.NET Web API 2 application (MVC 6) consists of two projects: Web API server project and Class Library project where I store all models. Server is very simple, only one controller is there. Server uses connection string to database which is located on Azure.

Now, when I try to enable migrations using Package Manager Console command EntityFramework\Enable-Migrations this error occurs:

Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProjec t' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable."

Every other command produces the same output.

I got my Server project as Default project in Package Manager Console window and as startup project in Solution Explorer.

My DbContext is in Server project.

Marcin Zdunek
  • 1,001
  • 1
  • 10
  • 25

1 Answers1

0

Please provide the paremeter -StartupProjectName on the Enable-Migrations command. If this still not working check your connection string. If you have more than one DbContext you must provide the DbContext class that you need to create the migrations for.