[英]Version issue with change from .net 4.5.2 to 4.0 in Entity Framework
I have an .edmx file which includes a lot of tables. 我有一个.edmx文件,其中包含很多表。 The file is inside a project created with .NET 4.5.2.
该文件位于使用.NET 4.5.2创建的项目中。 But my other projects are using .NET version 4.0 and i can not refer this project.
但是我的其他项目正在使用.NET 4.0版,因此我无法引用此项目。 I have to change my used .NET version to 4.0.
我必须将使用的.NET版本更改为4.0。 But it gives me an error below while rebuild process.
但这在重建过程中给我下面的错误。 I can not solve this.
我无法解决这个问题。
The primary reference "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework.
无法解决主要参考“ EntityFramework,版本= 6.0.0.0,区域性=中性,PublicKeyToken = b77a5c561934e089,processorArchitecture = MSIL”,因为它是针对“ .NETFramework,Version = v4.5”框架构建的。 This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".
这是当前目标框架“ .NETFramework,Version = v4.0”的更高版本。
You need to reinstall EF6 using nuget as explained here: https://docs.microsoft.com/en-us/nuget/consume-packages/reinstalling-and-updating-packages 您需要按照以下说明使用nuget重新安装EF6: https ://docs.microsoft.com/en-us/nuget/consume-packages/reinstalling-and-updating-packages
Go to Tools > NuGet Package Manager > Package Manager Console
Then type Update-Package -Id EntityFramework -Version 6.0.0 –reinstall
转到
Tools > NuGet Package Manager > Package Manager Console
然后键入Update-Package -Id EntityFramework -Version 6.0.0 –reinstall
You might need to edit your packages.config 您可能需要编辑packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.0.0" />
<!-- ... -->
</packages>
EF has both a net40 folder and a net45 folder. EF同时具有net40文件夹和net45文件夹。 You are most likely referencing the dll in net45.
您最有可能在net45中引用dll。 If you uninstalled the package and reinstalled as CodeCaster suggested, then you may have a stuck reference in your csproj file.
如果您卸载了软件包并按照CodeCaster的建议重新安装,则csproj文件中的引用可能卡住了。 You can try this:
您可以尝试以下方法:
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\\packages\\EntityFramework.6.1.3\\lib\\net45\\EntityFramework.dll</HintPath>
<Private>True</Private>
<HintPath>..\\packages\\EntityFramework.6.1.3\\lib\\net45\\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.