0
votes

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

1 Answers

0
votes

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.