Two ways I did it 1, you can check the process name
bool isRunningInIisExpress = Process.GetCurrentProcess() .ProcessName.ToLower().Contains("iisexpress");
Or update your configuration file using custom setup
<appSettings> <add key="ApplicationEnvironment" value="LOCAL_DEV" /> </appSettings>
What do you specifically update for each environment and have an application request for
I'm not sure if there is a way to determine this at compile time, in addition to having a special build configuration for each environment and placing a custom PRAGMA for each of these collections. Personally, I think this is not so elegant, but it can also work.
source share