This buildpack, before my last change, worked only for web applications. The last change in bin/compile
removes this restriction. Now, with this buildpack and a procfile with the following content at the root directory of the project, you could deploy a .NET Core 3.1 console app on Heroku.
worker: cd $HOME/heroku_output && ./MyProjectName
This is the Heroku buildpack for ASP.NET Core.
The Buildpack supports C# and F# projects. It searchs through the repository's folders to locate a Startup.*
or Program.*
file. If found, the .csproj
or .fsproj
in the containing folder will be used in the dotnet publish <project>
command.
If repository contains multiple Web Applications (multiple Startup.*
or Program.*
), PROJECT_FILE
and PROJECT_NAME
environment variables allow to choose project for publishing.
heroku buildpacks:set jincod/dotnetcore
heroku buildpacks:set https://github.com/jincod/dotnetcore-buildpack
heroku buildpacks:set https://github.com/jincod/dotnetcore-buildpack#version
Available releases
More info
You cannot run migrations with the dotnet ef
commands using .NET Local Tools once the app is built. Alternatives include:
- Ensure the
ASPNETCORE_ENVIRONMENT
environment variable is set toProduction
. ASP.NET Core scaffolding tools may create files that explicitly set it toDevelopment
. Heroku config will override this (heroku config:set ASPNETCORE_ENVIRONMENT=Production
). - Configure your app to automatically run migrations at startup by adding the following to the
.csproj
file:
<Target Name="PrePublishTarget" AfterTargets="Publish">
<Exec Command="dotnet ef database update" />
</Target>
- Configure your connection string string appropriately, for example, for PostgreSQL:
sslmode=Prefer;Trust Server Certificate=true
- Manually run SQL scripts generated by Entity Framework Core in your app's database. For example, use PG Admin to connect your Heroku Postgres service.
heroku buildpacks:set jincod/dotnetcore
heroku buildpacks:add --index 1 heroku/nodejs
Using Multiple Buildpacks for an App
If this project help you, you can give me a cup of coffee ☕