I'm trying to build a DotNetCore WebApi in Visual Studio Code with EntityFrameworkCore.
I've been reading a number of tutorials and I always get stuck at the point where it says:
Run Add-Migration InitialCreate
I get the following error:
The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program
Other tutorials say I should run this command
dotnet ef migrations add InitialCreate
Which gives me the error:
No executable found matching command "dotnet-ef"
These are the references in my csproj:
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3"/>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0-preview4-final"/>
How can I add a migration?
dotnet-ef
butdotnet ef
Also, ensure you're runningdotnet ef
from the directory containing theproject.json
– tchelidzedotnet ef
will calldotnet-ef
, that's perfectly normal. – DavidGDotNetCliToolReference
entry forMicrosoft.EntityFrameworkCore.Tools.Dotnet
? – DavidG