我有一个WPF应用程序,必须在同一台机器上的所有用户中运行,并具有相同的设置。这些设置必须是可读写的。我先前一直将用户配置设置存储在CommonApplicationData中,例如:
var settingsFile = Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.CommonApplicationData),
"[company]", "[product]", "settings.xml");
然而,我今天早上读到CommonApplicationData
是用于漫游配置文件的,这意味着它们不会与特定的计算机相关。从我找到的资料来看,我们有以下选项可供应用程序数据使用(来源):
// 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);
总结一下,选项如下:
- 单个用户,漫游
- 所有用户,漫游
- 单个用户,非漫游
你有什么想法吗?
CommonApplicationData
是漫游的?我觉得有点奇怪... - Anders Abel