I have an .edmx file which includes a lot of tables. The file is inside a project created with .NET 4.5.2. But my other projects are using .NET version 4.0 and i can not refer this project. I have to change my used .NET version to 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. This is a higher version than the currently targeted framework ".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
Go to Tools > NuGet Package Manager > Package Manager Console
Then type Update-Package -Id EntityFramework -Version 6.0.0 –reinstall
You might need to edit your 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. You are most likely referencing the dll in net45. If you uninstalled the package and reinstalled as CodeCaster suggested, then you may have a stuck reference in your csproj file. 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>
</Reference>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.