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
The compile error: Error NU1001 The dependency EntityFramework >= 6.1.3 could not be resolved. myWebProjectName C:...\WebAPI\ProductService\src\ProductService\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"
]
}
UPDATE
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:
UPDATE 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:
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.
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.
Do you see the DNX stuff like in this image?
Replace Entity FrameWork
"EntityFramework": "6.1.3"
, by"EntityFramework.Commands": "7.0.0-rc1-final"
, It Work Properly then bulid it. Also see the screeshot i added.