【问题标题】:Microsoft.AspNetCore.Authentication.JwtBearer Dependency could not be resolveMicrosoft.AspNetCore.Authentication.JwtBearer 依赖无法解析
【发布时间】:2017-02-21 20:47:18
【问题描述】:

我目前正在开发一个 api,需要安装这个包才能使用 jwt 身份验证。唯一的问题是我无法让它工作。 这是错误的图片:

这是我的 project.json 的副本:

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "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",
    "Core": "1.0.0-*",
    "Dtos": "1.0.0-*",
    "BundlerMinifier.Core": "2.2.281",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "AutoMapper": "5.2.0",
    "AutoMapper.Extensions.Microsoft.DependencyInjection": "1.1.0",
    "MongoDb": "1.0.0-*",
    "Core.DAL": "1.0.0-*",
    "PusherServer": "4.0.0-rc1",
    "Core.Documents": "1.0.0-*",
    "Core.Entities": "1.0.0-*",
    "Core.Automapper": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication": "1.0.0",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.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",
      "Views",
      "Areas",
      "Areas/**/Views",
      "appsettings.json",
      "appsettings.production.json",
      "appsettings.development.json",
      "bundleconfig.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "runtimes": {
    "win10-x64": {},
    "win8-x86": {},
    "win7-x86": {}
  }
}

dotnet restore 抛出的错误:

PATH=.\node_modules.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External \git C:\Program Files\dotnet\dotnet.exe restore "C:\Users\Andoni Zubizarreta\Documents\Projects\DeepMarket.vs\restore.dg" C:\Users\Andoni Zubizarreta\Documents\Projects\DeepMarket.vs\restore.dg(1,1):错误 MSB4025:无法加载项目文件。根级别的数据无效。第 1 行,位置 1。

如果您需要更多信息,请告诉我。提前致谢。

【问题讨论】:

  • 我将您的project.json 复制并粘贴到一个新项目中,并让它构建得很好。您能否发布dotnet restore 的结果,以便我查看错误是什么?
  • @A.Bello 感谢您的帮助。我知道这是一个奇怪的错误,我用错误更新了问题。

标签: c# asp.net-core jwt


【解决方案1】:

我通过在包管理器控制台中手动运行 dotnet restore 解决了这个问题。我的 Visual Studio 似乎在自动恢复包时遇到了问题。感谢您的帮助。

【讨论】:

    猜你喜欢
    • 2016-10-24
    • 2016-09-13
    • 1970-01-01
    • 1970-01-01
    • 2017-05-06
    • 2019-01-24
    • 2021-08-04
    • 2016-06-17
    相关资源
    最近更新 更多