我想开始使用EF
Microsofts docs
.一切都很好,但是当我尝试创建初始迁移时,PM抛出了一个异常。
Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly
'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable."
At C:\Users\Anton\.nuget\packages\entityframework\6.2.0\tools\EntityFramework.psm1:720 char:5
+ $domain.SetData('project', $project)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SerializationException
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
我在谷歌上搜索了很多,发现其他人
same problem
.我在那里尝试过所有的解决方案,尤其是那些包括设置启动项目在内的解决方案,但似乎都不起作用。
例如运行
-StartupProjectName WebApplication1
只是说了个错误
-StartupProjectName does not exist.
但是,如果我下载一个使用EF的示例项目,那么迁移似乎可以工作。我还尝试创建一个类lib项目并在那里完成迁移,但结果相同。