如何解决AspNet Core缺少依赖项的问题?

编程入门 行业动态 更新时间:2024-10-27 12:36:42
本文介绍了如何解决AspNet Core缺少依赖项的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因此,我对project.json进行了更改,从而导致了重新恢复,并带来了一堆无法解决的依赖关系.您如何弄清楚这里发生了什么?绝对有效,因为我针对该project.json文件编写了很多代码.

So I made a change to my project.json which caused a re-restore which is coming up with a bunch of unresolvable dependencies. How do you figure out what is going on here? This was definitely working as I wrote quite a bit of code against this project.json file.

"dependencies": { "EntityFramework.Commands": "7.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc2-*", "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Hosting": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", "Microsoft.Extensions.Configuration.Json": "1.0.0-*", "AspNet.Security.OAuth.Validation": "1.0.0-*", "OpenIddict": "1.0.0-*", "System.IdentityModel.Tokens.Jwt": "5.0.0-rc2-301150021", "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-15958", "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-15958", "EntityFramework.Sqlite": "7.0.0-rc2-*", "EntityFramework.Sqlite.Design": "7.0.0-rc1-final", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*" } NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.staticfiles/index.json 514ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.identity.entityframeworkcore/index.json 498ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.hosting.abstractions/index.json 1743ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.authentication/index.json 1745ms NotFound api.nuget/v3-flatcontainer/microsoft.extensions.fileproviders.embedded/index.json 1791ms NotFound api.nuget/v3-flatcontainer/microsoft.extensions.fileprovidersposite/index.json 1859ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.identity/index.json 1892ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.cors/index.json 1901ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.mvc/index.json 1875ms NotFound api.nuget/v3-flatcontainer/microsoft.aspnetcore.hosting/index.json 1887ms NotFound api.nuget/v3-flatcontainer/openiddict/index.json 1720ms

推荐答案

OpenIddict和所有aspnet-contrib项目已更新为使用.NET CLI和新的ASP.NET Core 1.0软件包,因此,如果您最近恢复了项目,则可能使用的是最新的每晚版本,而这些版本需要新的ASP. NET和aspnet-contrib软件包.

OpenIddict and all the aspnet-contrib projects have been updated to use .NET CLI and the new ASP.NET Core 1.0 packages, so if you restored your project recently, you're likely using the latest nightly builds, that require the new ASP.NET and aspnet-contrib packages.

要进行迁移,请安装.NET Core工具.

您还需要更新您的引用,才能使用ASP.NET Core RC2包.这是更新的project.json

You'll also need to update your references to use the ASP.NET Core RC2 packages. Here's an example of an updated project.json:

"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": "1.0.0-*" }, "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" ] } }

别忘了还要替换使用方法和以使用新的WebHostBuilder :

Don't forget to also replace the usings and to use the new WebHostBuilder:

public static class Program { public static void Main(string[] args) { var configuration = new ConfigurationBuilder() .AddEnvironmentVariables() .AddCommandLine(args) .Build(); var host = new WebHostBuilder() .ConfigureLogging(options => options.AddConsole()) .ConfigureLogging(options => options.AddDebug()) .UseConfiguration(configuration) .UseIISIntegration() .UseKestrel() .UseStartup<Startup>() .Build(); host.Run(); } }

祝你好运.

更多推荐

如何解决AspNet Core缺少依赖项的问题?

本文发布于:2023-11-16 06:30:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1601836.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何解决   AspNet   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!