I have a WPF application that must run for all users of a machine with the same settings. The settings must be read/write. I have previously been storing user configuration settings in CommonApplicationData, for example
var settingsFile = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.CommonApplicationData),
"[company]", "[product]", "settings.xml");
However I read this morning that CommonApplicationData
is used for roaming profiles, meaning they are not machine specific. From what I can find, we have the following options for application data (source):
// Store application-specific data for the current roaming user.
// A roaming user works on more than one computer on a network.
// A roaming user's profile is kept on a server on the network and is loaded onto a system ' when the user logs on.
System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
// Store in-common application-specific data that is used by all users.
System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
// Store application-specific data that is used by the current, non-roaming user.
System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
To summarize, the options are
What I need is all users, non-roaming. My initial thought is to chuck it all into the install folder, but that seems a little old-school?
Thoughts?
Here is a good explanation of the appdata folder and other items related to roaming user.
According to the MSDN Documentation:
CommonApplicationData
is "the directory that serves as a common repository for application-specific data that is used by all users"
whereas
LocalApplicationData
is "the directory that serves as a common repository for application-specific data that is used by the current, non-roaming user".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With