【问题标题】:Visual C# and SettingsVisual C# 和设置
【发布时间】:2010-10-13 13:38:33
【问题描述】:

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

【问题讨论】:

    标签: c# database settings


    【解决方案1】:

    问题已回答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.
    

    【讨论】:

      【解决方案2】:

      在我的 Windows 7 上,它将设置保存在

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

      【讨论】:

        【解决方案3】:

        在包含二进制文件的调试/发布文件夹中,它被命名为 yourapp.exe.config(或 web.config 用于 Web 应用程序)

        【讨论】:

        • 适用于特定应用选项。如果您将该设置标记为特定于用户,则它会进入您的用户配置文件文件夹。
        【解决方案4】:

        我认为您指的是 App.config?

        【讨论】:

          【解决方案5】:
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-12-10
          • 2011-08-25
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多