2

我做了所有被告知的事情[关于 OpenIddict 入门教程]

  • 我跑了 dnvm 升级
  • 我已将所有给定的源添加到 Nuget.Config
  • 在 project.json 依赖项中添加了 "OpenIddict": "1.0.0-*"

这就是当我将鼠标悬停在 project.json 中红色“OpenIddict”依赖项下划线时 Visual Studio 所告诉的内容:

项目 [...] 中的依赖项 OpenIddict 1.0.0-alpha2-0161 不支持框架 DNXCore,Version=v5.0

清理项目和恢复 nuget 包没有帮助。我应该怎么做才能让它工作?

编辑:

项目.json:

{
  "userSecretsId": "[...]",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
    "Microsoft.AspNet.Identity": "3.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "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",
    "Microsoft.Net.Http.Server": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "System.IdentityModel.Tokens": "5.0.0-rc1-211161024",
    "OpenIddict": "1.0.0-*"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}
4

1 回答 1

2

遗憾的是,您不能在 ASP.NET 5/Core RC1 应用程序中使用 OpenIddict:您必须使用 ASP.NET Core RC2,如入门页面中所述。

如果要迁移到 RC2,可以查看Mvc.Server示例:https ://github.com/openiddict/openiddict-core/tree/dev/samples/Mvc.Server 。

{
  "buildOptions": {
    "emitEntryPoint": true,
    "warningsAsErrors": true,
    "preserveCompilationContext": true,

    "embed": {
      "include": [ "Certificate.pfx" ]
    },

    "copyToOutput": {
      "include": [
        "wwwroot",
        "Views",
        "config.json",
        "web.config"
      ]
    }
  },

  "dependencies": {
    "AspNet.Security.OAuth.GitHub": "1.0.0-alpha4-final",
    "AspNet.Security.OAuth.Introspection": "1.0.0-alpha1-final",
    "AspNet.Security.OAuth.Validation": "1.0.0-alpha1-final",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Authentication.Twitter": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "OpenIddict": { "target": "project" }
  },

  "frameworks": {
    "net451": {
      "dependencies": {
        "Microsoft.NETCore.Platforms": "1.0.1-rc2-24027"
      }
    },

    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-rc2-3002702" }
      },

      "imports": [
        "dnxcore50",
        "portable-net451+win8"
      ]
    }
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
    }
  },

  "scripts": {
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "config.json",
      "web.config"
    ]
  }
}
于 2016-03-12T19:31:01.890 回答