efcore icon indicating copy to clipboard operation
efcore copied to clipboard

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.

Open EmpeRoar opened this issue 7 years ago • 10 comments

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 <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-rc1.19457.4" /> <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" /> </ItemGroup>

WebApi Project <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-rc1.19457.4" /> <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" /> </ItemGroup>

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

EmpeRoar avatar Sep 24 '19 02:09 EmpeRoar

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

erwan-joly avatar Sep 24 '19 02:09 erwan-joly

Microsoft.EntityFrameworkCore.Tools fixed it.

EmpeRoar avatar Sep 24 '19 03:09 EmpeRoar

I worked with Microsoft.EntityFrameworkCore.Tools fixed it.

edaluz007 avatar Jan 20 '20 09:01 edaluz007

Microsoft.EntityFrameworkCore.Tools fixed it. Thanks.

ghost avatar Apr 20 '20 05:04 ghost

Microsoft.EntityFrameworkCore.Tools 3.1.10 fixed it.

developernader avatar Nov 15 '20 18:11 developernader

Thanks You :>

AmirPow avatar Mar 30 '21 05:03 AmirPow

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

ddynamight avatar May 29 '21 07:05 ddynamight

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

jholsgrove avatar Jun 06 '21 19:06 jholsgrove

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.

Tailslide avatar Jun 19 '21 21:06 Tailslide

Microsoft.EntityFrameworkCore.Tools fixed it. Ty!

tarizshahid avatar Jul 22 '22 15:07 tarizshahid