简体   繁体   English

Microsoft.EntityFrameworkCore.SqlServer依赖关系无法解决

[英]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.

相关问题 无法找到无法找到包“Microsoft.EntityFrameworkCore.SqlServer” - Unable to find Unable to find package 'Microsoft.EntityFrameworkCore.SqlServer' Nuget 找不到包(Microsoft.EntityFrameworkCore.SqlServer) - Nuget pacakage (Microsoft.EntityFrameworkCore.SqlServer) can not found 使用复合键在 Microsoft.EntityFrameworkCore.SqlServer 5.0.8 C# 中进行更新 - Upsert in Microsoft.EntityFrameworkCore.SqlServer 5.0.8 C# with a composite key Microsoft.EntityFrameworkCore.SqlServer - 数据库未在 context.Database.Migrate() 上更新; - Microsoft.EntityFrameworkCore.SqlServer - Database not updating on context.Database.Migrate(); NU1107:Microsoft.EntityFrameworkCore.SqlServer 的 .Net Core 2.1 兼容替代品? - NU1107: .Net Core 2.1-compatible alternatives to Microsoft.EntityFrameworkCore.SqlServer? 错误 NU1202 Microsoft.EntityFrameworkCore.SqlServer 5.0.0 package 与 net50 不兼容 - Error NU1202 Microsoft.EntityFrameworkCore.SqlServer 5.0.0 package is not compatible with net50 无法解析包“Microsoft.EntityFrameworkCore.Tools.DotNet”的版本 - Version for package `Microsoft.EntityFrameworkCore.Tools.DotNet` could not be resolved 出现错误无法加载类型“Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute” - Getting Error Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute' ResolutionException-获取“无法解析类型***********的必需依赖项” - ResolutionException - Getting “Required dependency of type *********** could not be resolved” Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException - Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM