After updating an existing project to ASP.NET Core 1.1 and Entity Framework Core 1.1 using this tutorial
I tried to execute \"Add-Migration MigrationName\" in Package Ma
As per official ASP.NET Core team announcement (see GitHub) the Microsoft.EntityFrameworkCore.Tools
package was split into Microsoft.EntityFrameworkCore.Tools
and Microsoft.EntityFrameworkCore.Tools.DotNet
.
You need to reference the later one, if you want to continue to use the dotnet ef
commands. If you only want to use the old powershell styled commands (Database-Update
, Add-Migration
, etc.) the old package should be sufficient.
When referencing Microsoft.EntityFrameworkCore.Tools.DotNet``there is no need to also reference ``Microsoft.EntityFrameworkCore.Tools
.
Quote by Rowan Miller
If you are using ASP.NET Core, then you need to update the tools section of project.json to use the new Microsoft.EntityFrameworkCore.Tools.DotNet package (rather than the Microsoft.EntityFrameworkCore.Tools package).
"tools": { "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" },
As the design of .NET CLI Tools has progressed, it has become necessary for us to separate the dotnet ef tools into this separate package. Microsoft.EntityFrameworkCore.Tools is still used for Package Manager Console commands.
Now that EF Core is released it should be of course
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0"
},
Also please note, that the tools do not share the version with the EF itself. The latest version of the tools is still 1.0.0 for Tools.DotNet(see Nuget) and 1.1.0 for Tools (see Nuget again).
As mentioned in this blog,
We’re now encouraging everyone to migrate to MSBuild and csproj from project.json. As I stated above, we will not be supporting any of the new .NET Core tools in Visual Studio 2015. We also won’t be updating the Visual Studio 2015 project.json-based tools.
You are using EFCore.Tools
package version 1.1.0
which doesn't support project.json. The tooling for project.json never reached RTM. The suitable preview version to use for EF Core 1.1 packages is EFCore.Tools
1.1.0-preview4-final
.
Also as mentioned in other answers, if you want to use powershell commands then you need to install EFCore.Tools
package but if you want dotnet ef
then you need to install EFCore.Tools.DotNet
(version 1.1.0-preview3-final
since preview4-final had minor issue).
As noted above, there will not be any updates to project.json-based tools. You can still use above preview package though best option would be to migrate to VS2017 csproj when you can.
I believe the commads are different in .NET Core and EF Core.
Try
dotnet ef migrations add MigrationName
and
dotnet ef database update
Here are the dotnet cli commands