[英]Nuget error: 'EntityFramework 5.0.0' is not compatible with 'Microsoft.AspNet.Identity.EntityFramework 1.0.0
I've just created a Web API application for .Net 4.5 to do some tests with Unity (IoC framework)*. 我刚刚为.Net 4.5创建了一个Web API应用程序,以便使用Unity(IoC框架)*进行一些测试。
I've added Unity using Nuget: 我使用Nuget添加了Unity:
Install-Package Unity
Then I've added Mvc5 support 然后我添加了Mvc5支持
Install-Package Unity.Mvc5
For the backend, I created a class project with an EF model in it, with minimal content. 对于后端,我创建了一个包含EF模型且内容最少的类项目。 I registered it like this:
我这样注册:
container.RegisterType<MyEntities>();
To do a basic process test, I added a repository and registered it like so: 为了进行基本的流程测试,我添加了一个存储库并进行了如下注册:
container.RegisterType<IMyRepository, MyRepository>();
As far as I can tell everything is up and running, but when I execute, I get the notification that the Web API misses a reference to EF 5. 据我所知,一切都已经启动并且正在运行,但是当我执行时,我得到的通知是Web API缺少对EF 5的引用。
So I try add it like this: 所以我尝试像这样添加它:
Install-Package EntityFramework -Version 5.0.0
But then I get this error: 但是然后我得到这个错误:
Unable to resolve dependencies.
无法解决依赖关系。 'EntityFramework 5.0.0' is not compatible with 'Microsoft.AspNet.Identity.EntityFramework 1.0.0 constraint
'EntityFramework 5.0.0'与'Microsoft.AspNet.Identity.EntityFramework 1.0.0约束不兼容
The Microsoft.AspNet.Identity.EntityFramework
reference was added during Web API project creation and it's (strangely) actually version 2.0! 在Web API项目创建期间添加了
Microsoft.AspNet.Identity.EntityFramework
参考,(实际上)它是2.0版!
I want to leave the project as is, because I think the above reference is for authentication? 我想按原样保留该项目,因为我认为上述参考用于身份验证? And I will be needing that at some point.
我将在某个时候需要它。
Any ideas on how to fix this? 有想法该怎么解决这个吗?
Asp Identity Entity Framework 2 has dependency to Entity Framework version 6.0.1 and above. Asp Identity Entity Framework 2依赖于6.0.1及更高版本的Entity Framework。
Update your entity framework to latest version and then try your code. 将您的实体框架更新到最新版本,然后尝试您的代码。
Update-Package EntityFramework -version 6.1.3
更新包EntityFramework-版本6.1.3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.