存储用户设置到应用程序文件夹 [英] Store user settings into application folder

查看:155
本文介绍了存储用户设置到应用程序文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是从我的C#应用​​程序是这样设置:

I'm using setting from my C# application like this:

String str = Properties.Settings.Default.SETTINGS_NAME;

当我保存这个设置中,设置文件上创建

When I save this settings, a settings file is created on

C:\Documents and Settings\<user name>\Local Settings\Application Data\<comp name>\Keb.exe_Url_pbs4eg1o2ija22omldrwjxhdam0jxxi5\1.0.0.0\user.config

有没有办法来改变这种路径 Application.ExecutablePath \ user.config ,并使用它下一次,所以我的应用程序可以是更便携?

Is there a way to change this path to Application.ExecutablePath\user.config, and use it next time so my application can be more portable ?

推荐答案

您可以通过创建一个自定义的控制 user.config 文件的位置 SettingsProvider 。幸运的是,有人在$ C $的CProject 已经做到了。

You can control the location of the user.config file by creating a custom SettingsProvider. Luckily for you, someone at CodeProject already did that.

请参阅我的答案在这里所有的细节:<一href="http://stackoverflow.com/questions/1382617/how-to-make-designer-generated-net-application-settings-portable/2579399#2579399">How使设计器生成.NET应用程序的设置便携式

See my answer here for all the details: How to make designer generated .Net application settings portable

这篇关于存储用户设置到应用程序文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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