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

£可爱£侵袭症+ 提交于 2019-12-12 06:25:00

问题


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

  • VS 2015 Update 3
  • Not net framework 4.6.1

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


回答1:


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.



来源:https://stackoverflow.com/questions/40542792/how-to-resolve-the-dependency-on-microsoft-entityframeworkcore-sqlserver-and-mic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!