I am trying to create an application using Microsoft SQL Server database using Entity Framework Core.
This is what I have done so far
Step 1: From Nuget Package manager I have installed: Install-Package Microsoft.EntityFrameworkCore.SqlServer
Step 2: From Nuget Package manager I have installed (for Entity Framework commands) : Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
And my project.json looks as under
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
But it throws error
a) The dependency Microsoft.EntityFrameworkCore.SqlServer >= 1.0.1 could not be resolved. b) The dependency Microsoft.EntityFrameworkCore.Tools >= 1.0.0-preview3-final could not be resolved.
Screen shot
I am using
Why it is throwing the error and how can i fix it?
I think is because you are missing Microsoft.EntityFrameworkCore, try this:
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.EntityFrameworkCore": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final"
}
You won't need to restore the packages using Nuget, the changes in project.json should automatically restore those packages.
The above works for me, if it doesn't for you maybe there's something else, let me know.