我正在尝试将我的dotnet核心应用程序部署到Heroku,但不断遇到此错误:
Restore failed
unknown keyword platform
! Push rejected, failed to compile Web app app.
! Push failed
当我从CLI使用dotnet run
时(我在Mac上)一切正常。我已将Project.json
包含在下方以防有害:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2- final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"tooling": {
"defaultNamespace": "Tokens_monolith"
}
}
答案 0 :(得分:11)
我终于将它成功部署到了Heroku,它全部启动并运行。 Tseng对此有很大帮助,谢谢。我使用的buildpack是针对旧版本的.NET Core。 Heroku在这里有一个针对ASPNET5的实验构建包:https://github.com/heroku/dotnet-buildpack。
截至本回答时,此buildpack使用Mono进行运行时执行。有一个拉请求使用我使用的.NET CLI,它工作得很好。它可以在这里找到:https://github.com/noliar/dotnet-buildpack。希望他们很快接受这个拉动请求。这是我使用的buildpack。
希望这有助于某人。