加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 你如何解决AspNet Core缺少的依赖关系?

发布时间:2020-12-16 04:11:22 所属栏目:asp.Net 来源:网络整理
导读:所以我对我的project.json进行了更改,导致重新恢复,这会产生一堆无法解析的依赖项.你怎么知道这里发生了什么?这肯定是有效的,因为我写了很多针对这个project.json文件的代码. "dependencies": { "EntityFramework.Commands": "7.0.0-*","Microsoft.AspNet.A
所以我对我的project.json进行了更改,导致重新恢复,这会产生一堆无法解析的依赖项.你怎么知道这里发生了什么?这肯定是有效的,因为我写了很多针对这个project.json文件的代码.
"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 https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.staticfiles/index.json 514ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.identity.entityframeworkcore/index.json 498ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.hosting.abstractions/index.json 1743ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.authentication/index.json 1745ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.extensions.fileproviders.embedded/index.json 1791ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.extensions.fileproviders.composite/index.json 1859ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.identity/index.json 1892ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.cors/index.json 1901ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc/index.json 1875ms
  NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.hosting/index.json 1887ms

NotFound https://api.nuget.org/v3-flatcontainer/openiddict/index.json 1720ms

解决方法

OpenIddict和所有aspnet-contrib项目 have been updated to use .NET CLI and the new ASP.NET Core 1.0 packages,所以如果你最近恢复了你的项目,你可能会使用最新的每晚构建,这需要新的ASP.NET和aspnet-contrib软件包.

要迁移,install the .NET Core tooling.

您还需要更新引用以使用ASP.NET Core RC2包.这是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"
    ]
  }
}

不要忘记也更换使用和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();
    }
}

祝好运.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读