When using a Settings.settings file in .NET, where is the config actually stored?

后端 未结 10 774
予麋鹿
予麋鹿 2020-11-29 16:03

When using a Settings.settings file in .NET, where is the config actually stored? I want to delete the saved settings to go back to the default state, but can\'t find where

10条回答
  •  猫巷女王i
    2020-11-29 16:52

    While browsing around to figure out about the hash in the folder name, I came across (via this answer):

    http://blogs.msdn.com/b/rprabhu/archive/2005/06/29/433979.aspx

    (edit: Wayback Machine link: https://web.archive.org/web/20160307233557/http://blogs.msdn.com:80/b/rprabhu/archive/2005/06/29/433979.aspx)

    The exact path of the user.config files looks something like this:

    \\__\\user.config

    where

    - is either the roaming profile directory or the local one. Settings are stored by default in the local user.config file. To store a setting in the roaming user.config file, you need to mark the setting with the SettingsManageabilityAttribute with SettingsManageability set to Roaming.

    - is typically the string specified by the AssemblyCompanyAttribute (with the caveat that the string is escaped and truncated as necessary, and if not specified on the assembly, we have a fallback procedure).

    - is typically the string specified by the AssemblyProductAttribute (same caveats as for company name).

    and - information derived from the app domain evidence to provide proper app domain and assembly isolation.

    - typically the version specified in the AssemblyVersionAttribute. This is required to isolate different versions of the app deployed side by side.

    The file name is always simply 'user.config'.

提交回复
热议问题