Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I store machine-wide application settings for non-roaming users?

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

  • Single user, roaming
  • All users, roaming
  • Single user, non-roaming

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?

like image 241
Martin Doms Avatar asked Dec 06 '11 20:12

Martin Doms


1 Answers

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".

like image 177
competent_tech Avatar answered Oct 30 '22 13:10

competent_tech