I'm working on a project that was created using a version of dotnet core using a project.json file. I was able to add database migrations and create a database using dotnet ef cli commands in VS Code (add migrations, update, etc.).
However, I've recently migrated the project using the dotnet migrate command, so now my project has a .csproj file. I need to add more database migrations, but when I run the cli commands, I get an error stating the project.json file could not be found.
I've looked at documentation online (and searched the web) and I can't find anything telling me what I might have missed. FWIW, here are the possible relevant packages in my .csproj file:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" /> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0-preview4-final" />
New versions of the tooling were released for the new
.csproj way of doing things. You'll need to change your version of
You can see the different latest versions here on Nuget.
If you don't need the "dotnet ef" tools specifically you can also use the VS Powershell integrated version (Should you need the dotnet ef tools maybe steamrolla's post below can help you):
I use the following package references:
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" />
With these references set, it is possible to use the EF-Tools (Add-Migration, Update-Database, ...) from the Package Manager Console.