How to resolve the dependency on Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools?

.net-core entity-framework entity-framework-core

Question

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

enter image description here

I am using

  • VS 2015 Update 3
  • Not net framework 4.6.1

Why it is throwing the error and how can i fix it?

1
0
12/7/2018 9:20:03 PM

Popular Answer

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.

0
11/12/2016 5:40:59 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow