Sharing app.config across applications and accounts

260 Views Asked by At

I have an application (MainApp) which uses an app.config file created using the designer in VS. It has application-scoped settings which never change as well as user-scope settings which do change.

I want to create a second application (ConfigApp) which loads the first one's config file and provides a user-friendly designer for editing the user-scoped settings. This is no problem, I can add a reference to the main app from my config app and access MainApp.Properties.Settings.Default, and edit those properties and save them.

The problem there is that the settings are saved to a ConfigApp.exe.config file instead of the main app's config file, so when MainApp loads it doesn't see those changes in the config.

The other problem is that the config file is saved in the current user's AppData folder, which is what you'd usually want, but in my case, MainApp will for the most part be run under a different account than the one that ConfigApp will be run under.

So:

How can I read/write another application's config file in a strongly-typed way?

How can I read/write a config file to a specific user's AppData instead of the current user?

0

There are 0 best solutions below