简体   繁体   English

Nuget错误:“ EntityFramework 5.0.0”与“ Microsoft.AspNet.Identity.EntityFramework 1.0.0不兼容”

[英]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? 有想法该怎么解决这个吗?

  • I want to test registering an EF ObjectContext as a dependency, see my previous question . 我想测试将EF ObjectContext注册为依赖项,请参阅上一个问题

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。

See documentation 参阅文件

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.

相关问题 vsts构建在Microsoft.AspNet.Identity.EntityFramework上失败 - vsts build fails on Microsoft.AspNet.Identity.EntityFramework .NET Standard 2.0中的Microsoft.AspNet.Identity和Microsoft.AspNet.Identity.EntityFramework - Microsoft.AspNet.Identity and Microsoft.AspNet.Identity.EntityFramework in .NET Standard 2.0 不使用Microsoft.AspNet.Identity.EntityFramework的自定义Asp.net MVC 5身份验证 - Custom Asp.net mvc 5 authentication without using Microsoft.AspNet.Identity.EntityFramework 为什么IdentityUser类在Microsoft.AspNet.Identity.EntityFramework命名空间中而不在Core包中? - Why is the IdentityUser class in the Microsoft.AspNet.Identity.EntityFramework namespace and not in the Core package? 使用继承的Context时如何消除Microsoft.AspNet.Identity.EntityFramework依赖关系? - How to eliminate the Microsoft.AspNet.Identity.EntityFramework dependency when using an inherited Context? 自定义Microsoft.AspNet.Identity.EntityFramework.UserStore <TUser> - custom Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser> 无法从“字符串”转换为“ Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole - cannot convert from 'string' to 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole &#39;Microsoft.AspNet.Identity.EntityFramework.IdentityUser&#39;未标记为可序列化 - 'Microsoft.AspNet.Identity.EntityFramework.IdentityUser' is not marked as serializable Microsoft.AspNet.Identity.EntityFramework.IdentityUser 的外键? - Foreign Key To Microsoft.AspNet.Identity.EntityFramework.IdentityUser? 将AspNet.Identity.EntityFramework升级到2.1.0,并将EntityFramework升级到6.1.1 - Upgrading AspNet.Identity.EntityFramework to 2.1.0 and EntityFramework to 6.1.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM