[英]Unable to install EntityFramework 6.1.3 in VS2015 web project
In my VS2015 WebApi project, I try to install NuGet package EntityFramework 6.1.3 using the following command from Package Manager.在我的 VS2015 WebApi 项目中,我尝试使用包管理器中的以下命令安装 NuGet 包 EntityFramework 6.1.3。 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
The compile error : Error NU1001 The dependency EntityFramework >= 6.1.3 could not be resolved.编译错误:错误 NU1001 无法解析依赖项 EntityFramework >= 6.1.3。 myWebProjectName C:...\\WebAPI\\ProductService\\src\\ProductService\\project.json myWebProjectName C:...\\WebAPI\\ProductService\\src\\ProductService\\project.json
Here is my project.json file :这是我的 project.json 文件:
{
"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"
]
}
UPDATE更新
The Reference folder in the project is empty and there are no NuGet packages installed as shown in the project screenshots below:项目中的 Reference 文件夹是空的,并且没有安装 NuGet 包,如下面的项目屏幕截图所示:
Solution Explorer Window:解决方案资源管理器窗口:
UPDATE 2更新 2
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:关闭项目并重新打开后,参考文件夹显示两个文件夹 DNX 4.5.1 和 DNX Core5.0,并带有一些错误图标,如下所示:
I'm assuming you used the ASP.NET 5 template to create your Web API project.我假设您使用 ASP.NET 5 模板来创建您的 Web API 项目。
Right click on your references folder, in your project, and click "Restore Packages".右键单击您的项目中的引用文件夹,然后单击“恢复包”。 Then rebuild.然后重建。
I don't think Entity Framework 6 is supported for DNX Core.我认为 DNX Core 不支持 Entity Framework 6。 So you might have to remove that reference as well.因此,您可能还必须删除该引用。 Right-click on "EntityFramwork" under DNX Core 5.0 and click Uninstall Package.右键单击 DNX Core 5.0 下的“EntityFramwork”,然后单击“卸载包”。
Do you see the DNX stuff like in this image?你看到这张图片中的 DNX 东西了吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.