1

Possible Duplicate:
Using ConfigurationManager to load config from an arbitrary location

I'm using Setting File to store my application's settings. The setting file will be stored in %AppData%\CompanyName\user.config. How to change store location? Example: I want to save this config file in %AppData%\CompanyName\ApplicationName\Version\user.config

Thanks.

Community
  • 1
  • 1
Leo Vo
  • 9,980
  • 9
  • 56
  • 78

1 Answers1

0

You might decide to use .NET per-user(roaming) settings:

Configuration roamingConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);

According to MSDN, you cannot use OpenExeConfiguration because it accepts path to the executable, not the path to configuration file. You should use OpenMappedExeConfiguration with ExeConfigurationFileMap structure that contains full path to configuration file.

Daniel Protopopov
  • 6,778
  • 3
  • 23
  • 39