In general, the Environment.GetEnvironmentVariable is really designed for running on different servers, dev, staging, prod. WPF does not have a launchSettings.json file which does allow you to swap out to a different environment like with ASP.NET and set on the start app button in Visual Studio.
You could try something like the following in the pre-build event where you set Configuration for Conditional compilation symbol in the Build tab of project properties.
copy appSettings.$(Configuration).json appSettings.json
Edit, see this code sample which targets connections strings but can be adapted for other settings.