IApplicationBuilder UseCookieAuthentication 扩展方法在哪里?

Where is the IApplicationBuilder UseCookieAuthentication extension method?

我下载了一个私有的 git 项目,其他开发人员已经开发了几个月。在构建项目时,我运行遇到了几个问题:

现在我只剩下一个错误: IApplicationBuilder does not contain a definition for 'UseCookieAuthentication...

代码需要一个匿名函数:

app.UseCookieAuthentication(options =>
{
    options.AuthenticationScheme = "NLCookieMiddleware";
    options.LoginPath = new PathString("/api/Account/Login/");
    //options.AccessDeniedPath = new PathString("/Account/Forbidden/");
    options.AutomaticAuthenticate = true;
    options.AutomaticChallenge = true;
});

令我感到困惑的是,其他开发人员的构建没有问题,但没有向其 project.json 文件添加任何其他引用。他们的工作文件是:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",
  "dependencies": {
    "AutoMapper": "3.3.1",
    "Core": "1.0.0-*",
    "Data.EF": "1.0.0-*",
    "FluentMigrator": "1.6.0",
    "HtmlAgilityPack": "1.4.9",
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
    "Microsoft.AspNet.Identity": "3.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.Identity.Owin": "1.0.0-rc1",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-final",
    "WindowsAzure.Storage": "5.0.0",
    "System.Net.Http": "4.0.0",
    "RazorEngine": "4.2.3-beta1",
    "Microsoft.AspNet.Razor": "4.0.0-rc1-final",
    "premailer.net": "1.4.2",
    "Microsoft.Net.Http.Client": "1.0.0-beta6",
    "Moq": "4.2.1510.2205",
    "Serilog.Framework.Logging": "1.0.0-rc1-final-10071",
    "Microsoft.AspNet.WebApi.Client": "5.2.3",
    "Microsoft.Net.Http.Server": "1.0.0-rc1-final",
    "StructureMap.Dnx": "0.4.0-alpha4"
  },
  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },
  "frameworks": {
    "dnx451": {
      "dependencies": {
        "CMS.Services.Contracts": "1.0.0-*",
        "CSharpSDK": "1.0.0-*",
        "Lookups.Contracts": "1.0.0-*",
        "Services.Internal.Contracts": "1.0.0-*"
      },
      "frameworkAssemblies": {
        "System.ServiceModel": "4.0.0.0",
        "System.DirectoryServices.AccountManagement": "4.0.0.0"
      }
    }
  },
  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ]
}

我已经添加了无数其他软件包并尝试了它们的旧版本但没有成功:

这个扩展方法在哪里?为什么其他开发者没有这个问题?

这可能就是您要找的。请注意,它附带了一系列其他必需的 upgrades/new 库。抱歉,这可能非常令人沮丧。我分担你的痛苦。 :)

"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0" 添加到 project.json 文件中的 dependencies