我正在使用 Visual C# 内置功能设置 来保存我程序的一些选项。 看起来它正在使用 xml 文件来保存我的值,我可以轻松地保存和加载设置,我的问题是如果我将源代码编译为应用程序,它在哪里保存这些值?它是否在某处制作了一个 xml 文件,如果是,那么在哪里? 我编译了一个程序并更改了一些设置,然后我将这个可执行文件传输到我妈妈的计算机上,但它在选项中有默认值。当我在她的计算机上对应用程序进行更改时,它保存了所有内容并记住了这些值。 程序在哪里创建此 xml 文件以获取设置?
最佳答案
问题已回答here
user.config 文件是在 <c:\Documents and Settings>\<username>\[Local Settings\]Application Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison>
中创建的文件夹。其中:
* <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.
关于c# - Visual C# 和设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3924283/