'The EntityFramework package is not installed on project even though it is
I first had this issue after new version of EntityFramework came out. It says I could not Add-Migration because The EntityFramework package is not installed on project . Now before links This Answer. It's not that - see below:
And it is absolutely installed:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="6.0.3" />
<PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Discounted.Models\Discounted.Models.csproj" />
</ItemGroup>
</Project>
I originally fixed this issue by updating the packages.
I have tried:
- Rebuilding/Cleaning as well as
- Deleting the the obj & bin folders
- Restoring the the Project & Solution
Solution 1:[1]
There was two versions of Entity Framework Installed. After uninstalling the regular EF I had to restart visual studio to get it working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MrMoonMan |

