Konrad Viltersten
Konrad Viltersten

Reputation: 39250

Can't create migration because EntityFramework.Design package isn't recognized

I installed EntityFrameworkCore.Design running the following.

Install-Package Microsoft.EntityFrameworkCore.Design -Version 3.0.0-preview6.19304.10

It seems to be installed and I can see the following in VS.

[image]

However, when I try to create a migration using

dotnet ef migrations add Init

I get quite some time waiting followed by the error below.

Your startup project 'Web' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.

When I checked the Web.proj file, I get to see the following section.

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.0.0-preview6.19307.2" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-preview6.19304.10">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview6.19304.10" />
  <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
  <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc2" />
</ItemGroup>

How can I ensure that the computer sees the package?

Upvotes: 0

Views: 4845

Answers (1)

Code Name Jack
Code Name Jack

Reputation: 3323

You will need to refer additional packages for Migrations to work, add:

Microsoft.EntityFrameworkCore.Tools

Add it to the project that has data context.

Upvotes: 8

Related Questions