哪里有Properties.Default.Settings存储? [英] Where are the Properties.Default.Settings stored?

查看:425
本文介绍了哪里有Properties.Default.Settings存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我知道这一点,但今天我被证明是错误的 - 再次

I thought I knew this, but today I'm being proven wrong - again.

运行VS2008,.NET 3.5和C#。我加入了用户设置,使用默认值的属性设置选项卡,然后看他们在使用这种code:

Running VS2008, .NET 3.5 and C#. I added the User settings to the Properties Settings tab with default values, then read them in using this code:

myTextBox.Text = Properties.Settings.Default.MyStringProperty;

然后,用户编辑的选项对话框中的值后,我保存它是这样的:

Then, after the user edits the value in the options dialog I save it like this:

Properties.Settings.Default.MyStringProperty = myTextBox.Text;
Properties.Settings.Default.Save();

我的问题是,在这个新的价值得救了吗?在可执行目录中的文件MyApp.exe.config未更新,它仍然包含的缺省值。另外,据我所知,没有在该目录中的其他文件要么更新!然而,当程序读取值回,它会改变的值,所以我知道它保存在某处...

My question is, where is this new value saved? the MyApp.exe.config file in the executable directory is not updated, it still contains the default values. Plus, as far as I can tell, none of the other files in that directory are updated either! However, when the program reads the value back in, it gets the changed value, so I know it's saved somewhere...

这不仅是学术,我需要能够在今天上午手动编辑的价值,并给自己买了难倒,当我找不到任何东西被改变。

This isn't just academic, I needed to be able to manually edit the value this morning and got myself stumped when I couldn't find anything that was changing.

感谢您的洞察力, 戴夫

Thanks for any insight, Dave

推荐答案

为了与新版本只允许读取默认访问到Program Files文件夹中(除非您提示提升了UAC的Windows的政策工作,但这是另一个话题......),你的应用程序将在%USERPROFILE%\应用程序数据\本地%USERPROFILE%\ Local设置\一个设置文件夹应用数据,这取决于Windows版本你正在运行,因为设置是特定的用户。如果存储设置为所有用户,那么他们会在相应的文件夹下的 C:\用户或C:\ Documents和Settings 为所有用户配置文件(例如: C:\用户\ PUBLIC \应用程序数据\本地

In order to work with newer versions of Windows' policy of only allowing read access by default to the Program Files folder (unless you prompt for elevation with UAC, but that's another topic...), your application will have a settings folder under %userprofile%\appdata\local or %userprofile%\Local Settings\Application Data depending on which version of Windows you're running, for settings that are user specific. If you store settings for all users, then they'll be in the corresponding folder under C:\users or C:\Documents and Settings for all user profiles (ex: C:\users\public\appdata\local).

这篇关于哪里有Properties.Default.Settings存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆