2
我下载了一个私人的git项目,其他开发者一直在努力几个月。在构建项目时,遇到以下几个问题:IApplicationBuilder UseCookieAuthentication扩展方法在哪里?
- 要最初恢复软件包,我需要从命令行执行
dnu restore
。从Visual Studio 2015中恢复包似乎很好。 - 一个项目在.cs文件中仍然有一些缺失引用。我通过将软件包添加到相应的
project.json
文件来修复它。
现在我只剩下一个错误: 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"
]
}
我已经添加了其他无数的包,并试图旧版本的人,没有运气:
- Microsoft.AspNet.Authentication.Cookies
- Microsoft.Owin .Security.Cookies.Interop
此扩展方法在哪里存在?为什么其他开发者不会遇到这个问题?
对于我刚刚关闭Visual Studio并重新打开它修复此错误。 我已经添加了nuget软件包Microsoft.AspNetCore.Authentication.Cookies – Paul