Where are user-mode .NET settings stored?

前端 未结 3 1904
甜味超标
甜味超标 2020-11-29 05:39

I\'m wondering what is the magic behind .settings files in .NET. Imagine you create an assembly called in this example SettingsHolder, you create your settings

相关标签:
3条回答
  • 2020-11-29 06:17

    The settings file is contained inside the compiled assembly.

    Edit:

    Just to clarify a bit. The code to get and set the settings from the file are compiled into the assembly. The values themselves are moved into Program.exe.config where Program is the name of your application. Reflector will let you see the code that gets and sets the value including the hard-coded key to the config file. The config file itself will show you the value and allow you to change it after the application has been built.

    0 讨论(0)
  • 2020-11-29 06:29

    The setting files are stored in a different place for each user. To find them, click the start menu, click run, and paste:

    %USERPROFILE%\Local Settings\Application Data\
    

    and press enter. There will be a folder with your "Company Name" (whatever it is set to in your assembly) and then some more subfolders. The settings are stored in user.config.

    Full path:

    %USERPROFILE%\Local Settings\Application Data\<Company Name>\
    <appdomainname>_<eid>_<hash>\<verison>\user.config.
    

    In Windows Vista and newer, these are stored under:

    %USERPROFILE%\AppData\Local\
    

    More info:

    • http://www.codeproject.com/KB/vb/appsettings2005.aspx
    • http://www.google.com/search?q=.net+user.config
    0 讨论(0)
  • 2020-11-29 06:31

    On OS >= Vista I will claim the the user-setting file it's located here:

    %LOCALAPPDATA%\ yourcompany \ app-name \ ..\user.config

    0 讨论(0)
提交回复
热议问题