2010-10-13 51 views
2

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

回答

1

的问题已经asnwered here

<c:\Documents and Settings>\<username>\[Local Settings\]Application Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison>文件夹中创建user.config文件。其中:

* <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. 
+0

谢谢你的回答! – 2010-10-13 14:41:39

+0

我的荣幸!祝你K-1职业生涯顺利;) – 2010-10-13 14:50:02

0

与二进制调试/ release文件夹内,它的命名yourapp.exe.config(或web.config中的Web应用程序)

+1

对于特定于应用程序的选项为true。如果您将该设置标记为特定于用户的设置,它会进入您的用户配置文件文件夹。 – 2010-10-13 13:44:29

1

在我的Windows 7是

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

下保存设置我认为你指的是App.config?