mgimeno
mgimeno

Reputation: 23

Cloud Foundry .Net Core (Source-Based, Non-Published Deployment) on Release configuration (not Debug)

I'm pushing a .Net Core 2.2 app to Cloud Foundry.

The network I work on blocks the upload of binaries so instead of publishing the app and pushing it, We push the source code (Source-Based, Non-Published Deployment).

It all works fine however, it then always runs the app on Debug mode instead of Release.

I've tried modifying the cloud foundry start command. The command by default is:

cd ${DEPS_DIR}/0/dotnet_publish && exec ./API --server.urls http://0.0.0.0:${PORT}

I've tried by using something like

dotnet run --project pathtoproject --configuration Release

However, it does not recognize dotnet as a command even though I can see in the push logs that it does install dotnet sdk and runtime but only deletes the sdk when the script finishes, so the runtime should be still there. I probably need to use the full path to where dotnet is installed.

I've also noticed that the push script builds and publishes the app (in Debug mode) but I haven't seen anyway in which I can modify the publish call in order to use the --configuration Release argument.

Upvotes: 0

Views: 176

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

The dotnet core buildpack should pick Debug or Release based on the value you set for the environment variable PUBLISH_RELEASE_CONFIG, with a default of Debug.

See the code here, which selects the value, and here where the value is used with the call to publish.

Please give that a try. It sounds like it should do what you want.

Hope that helps!

Upvotes: 1

Related Questions