Body:
I’m trying to deploy a .NET Core console application (.NET 8) to Heroku, but I’m encountering an issue where the dotnet
command is not found when the application is started. Here’s a summary of what I’ve done:
-
Project Structure:
- My project directory contains the solution and the
Procfile
. - The
Procfile
is located in the root directory:C:WorkspaceMainProjectsMYPROJECT
. - The
.csproj
file is located inC:WorkspaceMainProjectsMYPROJECTMYPROJECT.ConsoleApp
.
- My project directory contains the solution and the
-
Procfile Content:
worker: dotnet MYPROJECT.ConsoleApp/bin/Release/net8.0/MYPROJECT.ConsoleApp.dll
-
Heroku Configuration:
- Set the buildpack:
heroku buildpacks:set https://github.com/jincod/dotnetcore-buildpack
. - Generated and added SSH keys.
- Configured the Heroku API key.
- Set the buildpack:
-
Deployment Steps:
- Initialized Git and committed the project.
- Created a Heroku app and added the remote.
- Pushed the code to Heroku and scaled the worker.
-
Environment Variables:
- Converted
appsettings.json
to Base64 and set it asAPPSETTINGS_BASE64
on Heroku.
- Converted
Despite following these steps, the deployment log shows that the dotnet
command is not found:
/app/worker.1: /bin/bash: line 1: dotnet: command not found
Deployment Log Excerpt:
2024-05-19T14:57:52.491062+00:00 app[worker.1]: /bin/bash: line 1: dotnet: command not found
2024-05-19T14:57:52.529056+00:00 heroku[worker.1]: Process exited with status 127
Questions:
- Why is the
dotnet
command not being found on Heroku? - How can I ensure that the
dotnet
command is available for my worker process? - Is there any additional configuration needed for the buildpack or the
Procfile
?
Any help or pointers to resolve this issue would be greatly appreciated!