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.
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
Should fix the issue if you add the package Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Tools fixed it.
I worked with Microsoft.EntityFrameworkCore.Tools fixed it.
Microsoft.EntityFrameworkCore.Tools fixed it. Thanks.
Microsoft.EntityFrameworkCore.Tools 3.1.10 fixed it.
Thanks You :>
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 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
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.
Microsoft.EntityFrameworkCore.Tools fixed it. Ty!