Visual C# 和设置

发布于 2024-09-27 10:38:24 字数 267 浏览 0 评论 0原文

我正在使用 Visual C# 内置功能设置来保存程序的一些选项。 看起来它正在使用 xml 文件来保存我的值,我可以轻松保存和加载设置,我的问题是如果我将源代码编译到应用程序,它在哪里保存这些值?它是否在某个地方创建了 xml 文件?如果是,那么在哪里? 我编译了一个程序并更改了一些设置,然后我将此可执行文件传输到我妈妈的计算机上,但它在选项中具有默认值。当我在她的计算机中使用应用程序进行更改时,它很好地保存了所有内容并记住了这些值。 程序在哪里创建这个 xml 文件来获取设置?

I am using Visual C# built in feature Settings to save some of my program's options.
It looks like it is using a xml file to save my values, I can save and load settings easily, my question is if I compile the source to an application, where does it hold these values? Does it make a xml filesomewhere, if it does, then where?
I compiled a program and changed some settings, then I transferred this executable to my mom's computer but it had default values in options. When I made changes with application in her computer, it saved everything well and it remembers those values.
Where does the program create this xml file to get settings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

别再吹冷风 2024-10-04 10:38:25

在带有二进制文件的 debug/release 文件夹中,它被命名为 yourapp.exe.config (或 web.config 对于 Web 应用程序)

inside the debug/release folder with the binary and it's named yourapp.exe.config (or web.config for web applications)

百合的盛世恋 2024-10-04 10:38:25

我想你指的是App.config?

I think you are referring to App.config?

℡寂寞咖啡 2024-10-04 10:38:24

该问题已在此处提出

user.config 文件在 \\[Local Settings\]Application Data\\__< 中创建。 hash>\ 文件夹。在哪里:

* <c:\Documents and Settings> is the user data directory, either non-roaming (Local Settings above) or roaming.
* <username> is the user name.
* <companyname> is the CompanyNameAttribute value, if available. Otherwise, ignore this element.
* <appdomainname> is the AppDomain.CurrentDomain.FriendlyName. This usually defaults to the .exe name.
* <eid> is the URL, StrongName, or Path, based on the evidence available to hash.
* <hash> is a SHA1 hash of evidence gathered from the CurrentDomain, in the following order of preference:
     1. StrongName
     2. URL

        If neither of these is available, use the .exe path. 
* <version> is the AssemblyInfo's AssemblyVersionAttribute setting.

The question has been asnwered here

The user.config file is created in the <c:\Documents and Settings>\<username>\[Local Settings\]Application Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison> folder. Where:

* <c:\Documents and Settings> is the user data directory, either non-roaming (Local Settings above) or roaming.
* <username> is the user name.
* <companyname> is the CompanyNameAttribute value, if available. Otherwise, ignore this element.
* <appdomainname> is the AppDomain.CurrentDomain.FriendlyName. This usually defaults to the .exe name.
* <eid> is the URL, StrongName, or Path, based on the evidence available to hash.
* <hash> is a SHA1 hash of evidence gathered from the CurrentDomain, in the following order of preference:
     1. StrongName
     2. URL

        If neither of these is available, use the .exe path. 
* <version> is the AssemblyInfo's AssemblyVersionAttribute setting.
嘿咻 2024-10-04 10:38:24

在我的 Windows 7 上,它将设置保存在

C:\Users\<user>\AppData\Roaming<application name>\<exefile name>\<version>\user.config

On my Windows 7 it saves the settings under

C:\Users\<user>\AppData\Roaming<application name>\<exefile name>\<version>\user.config
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文