The problem with this, is that you can't have a release pipeline for a specific environment, since the only way to include an embedded resource is to recompile the application with it.
It's not sufficient to just overwrite the existing appsettings.json with the required appsettings.[environment].json, since this won't "embed" the file in the executable (and the file doesn't exist anyway).
It would be better to allow appsettings.json to exist as an ordinary file next to the application (like in back-ends, Blazor and Migration tools) and to read it with:
When generating a WPF application, the appsettings.json is set up to be read as an embedded resource:
The problem with this, is that you can't have a release pipeline for a specific environment, since the only way to include an embedded resource is to recompile the application with it. It's not sufficient to just overwrite the existing
appsettings.json
with the requiredappsettings.[environment].json
, since this won't "embed" the file in the executable (and the file doesn't exist anyway).It would be better to allow
appsettings.json
to exist as an ordinary file next to the application (like in back-ends, Blazor and Migration tools) and to read it with:This way, the release pipeline can just overwrite the file with the one from the correct deployment environment.