在VS2015 Web项目中无法安装EntityFramework 6.1.3 [英] Unable to install EntityFramework 6.1.3 in VS2015 web project

查看:1053
本文介绍了在VS2015 Web项目中无法安装EntityFramework 6.1.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的VS2015 WebApi项目中,我尝试使用包管理器中的以下命令安装NuGet包EntityFramework 6.1.3。该命令成功运行,如下面的消息所示。但是,该程序包仍未安装,编译该项目时出现错误:

In my VS2015 WebApi project, I try to install NuGet package EntityFramework 6.1.3 using the following command from Package Manager. The command runs with success as the message below shows. But the package is still not installed and I get an error when I compile the project:

PM> Install-Package EntityFramework
Installing NuGet package EntityFramework.6.1.3.
Successfully installed 'EntityFramework 6.1.3' to myWebProjectName

编译错误
错误NU1001无法解析依赖项EntityFramework> = 6.1.3。 myWebProjectName C:... \WebAPI\ProductService\src\ProductService\project.json

The compile error: Error NU1001 The dependency EntityFramework >= 6.1.3 could not be resolved. myWebProjectName C:...\WebAPI\ProductService\src\ProductService\project.json

这是我的project.json文件

Here is my project.json file:

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework": "6.1.3",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.WebApi.OData": "5.7.0",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

更新

项目中的Reference文件夹为空,没有NuGet软件包安装如下面的项目截图所示:

The Reference folder in the project is empty and there are no NuGet packages installed as shown in the project screenshots below:

解决方案资源管理器窗口:

Solution Explorer Window:

更新2

关闭项目并重新打开它,参考文件夹显示两个文件夹DNX 4.5.1和DNX Core5.0,其中包含一些错误图标,如下所示:

After I closed the project and re-opened it, the Reference folder is showing two folders DNX 4.5.1 and DNX Core5.0 with some error icons as shown below:

推荐答案

我假设您使用ASP.NET 5模板来创建Web API项目。

I'm assuming you used the ASP.NET 5 template to create your Web API project.

右键单击您的项目中的参考文件夹,然后单击恢复包。然后重建。

Right click on your references folder, in your project, and click "Restore Packages". Then rebuild.

我不认为DNX Core支持实体框架6。所以你也可能需要删除该引用。右键单击DNX Core 5.0下的EntityFramwork,然后单击卸载软件包。

I don't think Entity Framework 6 is supported for DNX Core. So you might have to remove that reference as well. Right-click on "EntityFramwork" under DNX Core 5.0 and click Uninstall Package.

你看到这个图像中的DNX的东西吗?

Do you see the DNX stuff like in this image?

这篇关于在VS2015 Web项目中无法安装EntityFramework 6.1.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆