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

.net-core .net-core-3.0 c# ef-core-3.0 entity-framework-core

Question

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?

1
0
7/17/2019 8:26:53 AM

Accepted Answer

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

Microsoft.EntityFrameworkCore.Tools

Add it to the project that has data context.

5
7/17/2019 9:13:14 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow