My.Settings 保存在 VB 2010 .NET 中的什么位置? [英] Where are My.Settings saved in VB 2010 .NET?

查看:34
本文介绍了My.Settings 保存在 VB 2010 .NET 中的什么位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

My.Settings 值是保存在程序本身中还是存储在注册表中?因此,例如,如果我使用程序设置了 My.Settings 值,然后我将程序本身复制到另一台 PC - My.Settings 值是否仍然设置?

Are My.Settings values saved in the program itself or do they get stored in the registry? So, for example, if I set a My.Settings value with a program, then I copy the program itself to another PC - is the My.Settings value still set?

推荐答案

这取决于 范围 您已选择.有两个范围设置 - 应用范围和用户范围.

It depends upon the scope you have selected. There are two scope settings - Application and User scope.

来自 MSDN 文章:

From MSDN article:

应用程序范围的设置是只读的,在所有用户之间共享该应用程序的用户.这些设置存储在 app.config部分中的文件.在运行时,app.config文件将在您的 bin 文件夹中,并以您的名称命名应用程序的名称(MySettingsDemo.exe.config).

Application-scoped settings are read-only and are shared between all users of that application. These settings are stored in the app.config file in the section. At run time, the app.config file will be in your bin folder and will be named with your application's name (MySettingsDemo.exe.config).

用户范围设置是针对每个用户的.它们可以被阅读和在运行时由应用程序代码安全设置.这些设置是存储在 user.config 文件中.为了技术上的准确,有每个应用程序每个用户有两个 user.configs——一个用于非漫游,一个用于用于漫游.尽管 Visual Basic 2005 文档指出user.config 文件将根据用户名命名(joe.config),事实并非如此.在 user.config 文件中创建:

User-scope settings are specific for each user. They can be read and set safely by the application code at run time. These settings are stored in a user.config file. To be technically accurate, there are two user.configs per user per application—one for non-roaming and one for roaming. Although the Visual Basic 2005 documentation states that the user.config file will be named according to the user's name (joe.config), this is not the case. The user.config file is created in the:

<c:Documents and Settings><username>[LocalSettings]ApplicationData<companyname><appdomainname>_<eid>_<hash><verison>.

这篇关于My.Settings 保存在 VB 2010 .NET 中的什么位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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