Reputation: 256581
i've created some Application settings (i.e. not User) settings in my Visual Studio project:
This application will be running from a shared (i.e. read-only, network) location. How do i alter the application settings? e.g.
fvirm001
QnV0IHNoZSdzIGluIGxvdmUgd2l0aCBzb21lb25lIGVsc2Uu
In the olden days (last Thursday) i would create a MyApp.ini
file (in the same folder as MyApp.exe
), and read the settings from there.
In the new XML .NET world i might change it to MyApp.xml
. But then i remembered that .NET already has an XML file to store application settings. (e.g. the customer might want to manage the set of trace listeners in app.config).
How do i manage the <applicationSettings>
in app.config
?
Can i simply create an app.config
file in the application directory, and .NET will use values as an override?
Microsoft's MSDN page on Managing Application Settings does not mention how to manage application settings.
Upvotes: 1
Views: 933
Reputation: 12119
Check out the Reload
method of the ApplicationSettingsBase
class...
Once you update the settings (either manually or from your UI) you'll have to use this method to reload the settings from the config file.
Reload contrasts with Reset in that the former will load the last set of saved application settings values, whereas the latter will load the saved default values.
Upvotes: 1
Reputation: 8477
You can change the values in the Settings designer window you have open. But yes, they're stored in the config file (ProgramExecutable.exe.config
).
Application Settings are not designed to be changed by the user, so there's no way to change them at runtime (unlike User settings, which can be reassigned and saved).
Upvotes: 1