Thanks for reaching out and welcome to the Octopus forums!
It’s looking like step 3 is failing due to $environmentVariables being null.
To simplify the Environment Variable Value parameter, I think we could just have a normal project variable there and then in the variables section of the project create that variable but with 2 scopes so that when DEV is running, the value is Development, and when PROD is running, the value is Production.
So, do I understand that I should remove the ASPNETCORE_ENVIRONMENT from the web.config file and rely on the Octopus Deploy step you pointed out to set it? That is straight forward.
Here is what was being tried, but it didn’t make it this far as it failed on step…
“This step is based on a custom ASP.NET Core - set runtime environment variable via web.config - Changes step template.”
Corporate support had me remove all web.ENV.config files and only retain the web.config file. They are currently in the process of debugging. I don’t want to make any changes while they are in there, but once I get back in I will let you know how it goes.
Do you mind if we take a step back for a minute? I’ve looked at your process again. Is there any reason you can’t do the substitution on that file with Structured Configuration Variables? Structured configuration variables - Octopus Deploy
You could potentially enable this and use this on your Step 2 and not need Step 3 at all. Can you please give that documentation a look and let me know if you think it will fulfill what you need out of Step 3?
You would still need to create the variable/values as I showed in my screenshot above to make that work, though.