Reputation: 64207
I am exploring the new Entity Framework Core (NOT in conjunction with ASP.Net, nor under Linux, what I am coding is just a classic WinForms app built with Visual Studio under Windows 7 64-bit using SQLite as the database engine).
Trying to reproduce this example I have found out that I need the dotnet.exe
tool that is not a part of Visual Studio 2015 and to be installed with .NET Core tools preview for Visual Studio.
After having installed it I have faced another error: while trying to execute dotnet ef migrations add InitialCreate -c SqliteEfcExampleContext
: No executable found matching command "dotnet-ef"
.
I have then Googled upon a hint saying I need to install Microsoft.EntityFrameworkCore.Tools.DotNet
with NuGet.
It refused to install saying I need a more recent version of NuGet itself. So I have updated NuGet from https://dotnet.myget.org/F/nuget-beta/vsix/
.
But I still can't install Microsoft.EntityFrameworkCore.Tools.DotNet
- it says `Severity Code Description Project File Line Suppression State Error Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final' has a package type 'DotnetCliTool' that is not supported by project 'SqliteEfcExample'.
How do I create the migrations anyway?
Upvotes: 1
Views: 2214
Reputation: 64207
I have found the answer myself, let me share it again...
After executing the steps described in the question I have
Installed Windows Management Framework 5.0 to get PowerShell updated.
Went to Tools - NuGet Package Manager - Package Manager Console
to execute the following command manually: PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Pre
.
Then I have found relevant Package Manager Console commands (Add-Migration, Update-Database, Scaffold-DbContext, etc.) working and used Add-Migration SqliteEfcExampleContext
to generate the migration code for the model code I've already written.
UPDATE:
The quest has continued and I have faced another problem - the ... violates the constraint of type 'TContext'
error trying to use the above mentioned commands then. I have described it together with the solution in an answer to a question about the same error found in slightly different context.
Upvotes: 1