我的ASP.NET Web API 2应用程序(MVC 6(由两个项目组成:Web API服务器我存储所有模型的项目和班级库项目。服务器非常简单,只有一个控制器。服务器使用位于Azure上的数据库使用连接字符串。
现在,当我尝试使用软件包管理器命令EntityFrameworkEnable-Migrations
启用迁移时,此错误发生:
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."
其他每个命令都会产生相同的输出。
我在软件包管理器窗口和解决方案Explorer中将服务器项目作为默认项目作为默认项目。
我的dbcontext在服务器项目中。
请在enable迁移命令上提供对代表者-startupprojectname。如果仍然无法使用,请检查您的连接字符串。如果您有一个以上的dbcontext,则必须提供为创建迁移的DBContext类。