By default Heroku does not support the .NET platform. But as they say, you can use any language that runs on Linux with Heroku via a third-party buildpack. And that’s exactly what happens with .NET, so we can use the dotnetcore-buildpack.
From Heroku main page, create a new application (i.e. mydotnetapp with region set to Europe).
Log in to Heroku from command line:
$ heroku login
Set the buildpack our new app has to use:
$ heroku buildpacks:set jincod/dotnetcore -a mydotnetapp
Set up Git in our project directory, keeping in mind the buildpack expects to find a Program.cs file in this directory.
$ git init $ heroku git:remote -a mydotnetapp
It’s probably a good idea to create a .gitignore file to exclude everything we don’t need to send to Heroku:
.DS_Store bin/ obj/ appsettings.Development.json
Push project to Heroku:
$ git add . $ git commit -m "First working version" $ git push heroku master
It’s important to realize that this process is a bit different from what we do when deploying to other platforms as Azure:
Azure ⇒ we push some publish folder after running:
dotnet publish -c Release -o ./publish
Heroku ⇒ we push the folder with our .NET project, the one that includes the Program.cs file (we don’t need to previously run any