Our .net core web project contained no web.config. We are aware of that dotnet publish will create the file if it does not exist.
However, we found it odd that the ASPNETCORE_ENVIRONMENT environment variable was also being set in this new web.config, even when we were NOT specifying it with the p:EnvironmentName parameter in the publish option of the dotnet/DotNetCoreCLI@2 command.
We discovered that we had a variable group in ADO with an EnvironmentName variable defined and publish was implicitly using this variable.
It is not clear to me how this variable is being transfered to the publish command. I did find that ADO variables are loaded as environment variables. But does publish look for environment variables that match environment vars to use as defaults? In a "Transform web.config" documentation there are these somewhat obscure references:
It references a build "property" but demonstrates a variable syntax.
How is this EnvironmentName parameter being inferred from this ADO variable?