c# - 如何修复错误 : "Could not find schema information for the attribute/element" by creating schema

标签 c# error-handling database-schema application-settings

我有一个用 C# 用 VS2010 编写的 Windows 窗体应用程序,在 app.config 文件中出现以下错误:

Message 4   Could not find schema information for the attribute 'name'
Message 8   Could not find schema information for the attribute 'name'
Message 12  Could not find schema information for the attribute 'name'
Message 5   Could not find schema information for the attribute 'serializeAs'
Message 15  Could not find schema information for the element 'CCP_Utility.Settings1'
Message 2   Could not find schema information for the element 'CCP_Utility.Properties.Settings'
Message 3   Could not find schema information for the element 'setting'
Message 1   Could not find schema information for the element 'userSettings'
Message 6   Could not find schema information for the element 'value'

我必须更改代码中的哪些内容才能解决此问题?我在哪里可以编辑 CCP_Utility.Settings1CCP_Utility.Properties.Settings 中的内容?

这是 app.config 代码:

<configuration>
<configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
        <section name="CCP_Utility.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        <section name="CCP_Utility.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
  </configSections>
<userSettings>
  <CCP_Utility.Properties.Settings>
    <setting name="SourceDir" serializeAs="String">
      <value />
    </setting>
    <setting name="TargetDir" serializeAs="String">
      <value />
    </setting>
    <setting name="CorpID" serializeAs="String">
      <value />
    </setting>
  </CCP_Utility.Properties.Settings>
    <CCP_Utility.Settings1>
        <setting name="sourceDir" serializeAs="String">
            <value />
        </setting>
        <setting name="targetDir" serializeAs="String">
            <value />
        </setting>
    </CCP_Utility.Settings1>

   </userSettings>
</configuration>

最佳答案

解决问题的最快、最简单、最懒惰的方法:

  1. 在解决方案资源管理器中右键单击项目图标并选择“属性”。
  2. 转到“应用程序”选项卡并选择一个较早的 .NET 目标框架。
  3. 保存更改。
  4. 转到“应用程序”选项卡并选择初始 .NET 目标框架。
  5. 保存更改 => 问题已解决!

关于c# - 如何修复错误 : "Could not find schema information for the attribute/element" by creating schema,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5303476/

相关文章:

c# - 使用大集合反序列化 JSON

c# - CaSTLe Windsor 拦截器不适用于方法级属性

r - 为数据框分配列表-出现错误: invalid factor level, NA generated

error-handling - 如何从 Loopback 4 中的 Controller 返回错误?

mysql - 对于公交车时刻表,我应该为所有公交车准备一个数据表并将时间表存储在一列中,还是为每辆公交车创建单独的表?

c# - asp.net mvc time ago in words helper

c# - 类型 'iTextSharp.text.Document' 的值无法转换为 'System.IO.Stream'

python - 如何摆脱vs Studio Python 3中突出显示的错误

mysql - 为类别、子类别和相关图书设计数据库

asp.net - SQL Server 2008 架构更改的最佳实践