[英]Microsoft.EntityFrameworkCore.SqlServer dependency could not be resolved
I am trying to install Entity Framework Core in VS 2015, Update 3, so I can reverse-engineer EF models from an existing database. 我正在尝试在VS 2015 Update 3中安装Entity Framework Core,因此可以从现有数据库对EF模型进行反向工程。 I am following the directions from Microsoft, here: https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db .
我正在按照Microsoft的指示在这里: https : //docs.microsoft.com/zh-cn/ef/core/get-started/aspnetcore/existing-db 。
However, as soon as this line is added to my project.json file: 但是,只要将此行添加到我的project.json文件中:
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0"
I get a "Package restore failed" error in my References, saying the dependency could not be resolved. 我的参考中出现“程序包还原失败”错误,说无法解决依赖关系。 I get this same error no matter what version I specify.
无论指定哪个版本,我都会遇到同样的错误。
Below is the full content of my package.json file - the only line I added is the one mentioned above. 以下是我package.json文件的全部内容-我添加的唯一一行是上述内容。 All the rest are there by default when I create the project from the "New ASP.NET Core Web Application" template.
默认情况下,当我从“新ASP.NET Core Web应用程序”模板创建项目时,其余所有内容都在那里。
I have tried adding a reference to Microsoft.EntityFrameworkCore, as suggested here: How to resolve the dependency on Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools? 我尝试添加对Microsoft.EntityFrameworkCore的引用,如下所示: 如何解决对Microsoft.EntityFrameworkCore.SqlServer和Microsoft.EntityFrameworkCore.Tools的依赖关系? , but I get the same error message with regard to that reference (again, no matter what version I specify).
,但相对于该引用,我仍然收到相同的错误消息(同样,无论我指定的是哪个版本)。
Can anyone explain what the problem is, and how a person is supposed to be able to figure this out from the minimal information provided? 谁能解释这个问题是什么,一个人应该如何从提供的最少信息中找出问题所在?
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Turns out the problem for me was an invalid package source. 原来对我来说问题是无效的软件包源。 I removed the invalid source in the NuGet Package Manager, and I was then able to add the reference.
我在NuGet软件包管理器中删除了无效的源,然后可以添加引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.