dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.83k stars 3.2k forks source link

add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. #18009

Closed EmpeRoar closed 2 years ago

EmpeRoar commented 5 years ago

When trying to create a new Migration in Visual Studio 2019 add-migration SomeMigrationName

this throws an error. "add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

this used to work fine before I upgrade to Version 16.3.0 Preview 4.0

Steps to reproduce

Upgrade VS 2019 to Version 16.3.0 Preview 4.0

Dotnet Version. 3.0.100-rc1-014190

EF Library Project `

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-rc1.19456.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-rc1.19456.14">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-rc1.19456.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" />

`

WebApi Project `

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-rc1.19456.14">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0-rc1.19456.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />

`

Further technical details

EF Core version: 3.0.0-rc1.19456.14 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .net core 3.0.100-rc1-014190 Operating system: Windows 10 Prop IDE: Visual Studio 2019 Version 16.3.0 Preview 4.0

erwan-joly commented 5 years ago

Should fix the issue if you add the package Microsoft.EntityFrameworkCore.Tools

EmpeRoar commented 5 years ago

Microsoft.EntityFrameworkCore.Tools fixed it.

edaluz007 commented 4 years ago

I worked with Microsoft.EntityFrameworkCore.Tools fixed it.

Manirutha commented 4 years ago

Microsoft.EntityFrameworkCore.Tools fixed it. Thanks.

developernader commented 4 years ago

Microsoft.EntityFrameworkCore.Tools 3.1.10 fixed it.

AmirPow commented 3 years ago

Thanks You :>

ddynamight commented 3 years ago

I am having this same issue with .NET 5. Any workaround for this? Note I just updated VS 2019 to version 16.10.0.

jholsgrove commented 3 years ago

I am having this same issue with .NET 5. Any workaround for this? Note I just updated VS 2019 to version 16.10.0.

I got it to work by running: dotnet tool install --global dotnet-ef

Tailslide commented 3 years ago

Also having this issue on .NET 5 - VS2019 Version 16.11.0 Preview 2.0 The suggestion above just gives me Tool 'dotnet-ef' is already installed.

tarizshahid commented 2 years ago

Microsoft.EntityFrameworkCore.Tools fixed it. Ty!