Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying dotnet core to Heroku

I'm trying to deploy my dotnet core application to Heroku, but keep running up against this error:

Restore failed
unknown keyword platform
 !     Push rejected, failed to compile Web app app.
 !     Push failed

When I use dotnet run from the CLI (I'm on a mac) everything runs fine. I've included my Project.json below in case that helps:

{
  "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"
}
}
like image 596
pgruber Avatar asked Aug 13 '16 08:08

pgruber


1 Answers

I finally got this successfully deployed to Heroku, it's all up and running. Tseng was a huge help on this, so thank you. My buildpack that I was using was targeting an older version of .NET Core. Heroku has an experimental buildpack targeting ASPNET5 here: https://github.com/heroku/dotnet-buildpack.

As of the time of this answer, this buildpack is using Mono for runtime execution. There is a pull request to use the .NET CLI that I used and it works great. It can be found here: https://github.com/noliar/dotnet-buildpack. Hopefully they accept this pull request soon. This was the buildpack that I used.

Hope this helps someone.

like image 61
pgruber Avatar answered Nov 11 '22 08:11

pgruber