When I run my WPF application, it creates the user.config
file in the following location C:\Users\[user]\AppData\Local\[company]\[applicationName]\1.0.0.0
but I want it to run from a different location, something like C:\Users\[user]\AppData\Local\[company]\UserConfig
.
In my App.xaml.cs
, I create an OnStartup
method, which generates a new user.config
file, and I thought the following code would do what I am looking for:
// Open the custom configuration file
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = configFile;
Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
But seems I was wrong.
Note: configFileMap
is my new location and configFile
is my user.config
.
Any help would be greatly appreciated.
Thank you!