Asp.net core 如何解决AspNet核心缺少依赖项的问题?
所以我对project.json做了一个更改,这导致了一个重新恢复,它带来了一系列无法解决的依赖项。你怎么知道这里发生了什么?这确实有效,因为我针对这个project.json文件编写了很多代码Asp.net core 如何解决AspNet核心缺少依赖项的问题?,asp.net-core,aspnet-contrib,openiddict,Asp.net Core,Aspnet Contrib,Openiddict,所以我对project.json做了一个更改,这导致了一个重新恢复,它带来了一系列无法解决的依赖项。你怎么知道这里发生了什么?这确实有效,因为我针对这个project.json文件编写了很多代码 "dependencies": { "EntityFramework.Commands": "7.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Diagnostics
"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
项目,因此如果您最近恢复了项目,您可能会使用最新的夜间版本,这需要新的ASP.NET和aspnet contrib包
要迁移
您还需要更新引用以使用ASP.NET Core RC2包。以下是一个例子:
别忘了更换usings和:
公共静态类程序{
公共静态void Main(字符串[]args){
var configuration=new ConfigurationBuilder()
.AddenEnvironmentVariables()
.AddCommandLine(args)
.Build();
var host=new WebHostBuilder()
.ConfigureLogging(选项=>options.AddConsole())
.ConfigureLogging(选项=>options.AddDebug())
.UseConfiguration(配置)
.Useii整合()
.UseKestrel()
.UseStartup()
.Build();
host.Run();
}
}
祝你好运。首先,不要混用软件包版本。使用所有rc1或所有rc2等。也不要将“旧的”(.AspNet.-rc1或旧的)包与新的(.AspNetCore.-rc2-尚未发布)包混合使用。如果您决定使用rc2,请从dnx切换到dotnet。正如@Pinpoint的答案所指出的,现在您需要使用aspnetcidev提要。您可以在中找到在dotnet上运行的ASP.Net核心应用程序的一些示例。如果您需要有关.Net CLI/ASP.Net核心迁移的帮助,请随时加入我们。呵呵,这是使用预发布软件的代价。如果您共享一两条消息,这会有所帮助;)您是否能够通过
dotnet
命令(即不使用dnx)运行aspnet core应用程序-我已经尝试了一天了:/Updated以使用最终的ASP.NET core RC2软件包。不确定是谁否决了您的答案,但是+1给出了一个极好的建议:永远不要混合使用旧软件包和新软件包。
"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"
]
}
}
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();
}
}