开发者

Visual C# and Settings

I am using Vis开发者_如何学运维ual 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?


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.


On my Windows 7 it saves the settings under

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


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


I think you are referring to App.config?


Check out http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜