我有一个用C#用VS2010编写的Windows窗体应用程序,app.config文件中出现以下错误:
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.Settings1和CCP_Utility.Properties.Settings?
CCP_Utility.Settings1
CCP_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>
2015年9月更新 此答案继续受到好评,因此我将其保留在此处,因为它似乎对某些人有帮助,但请首先查看@reexmonkey和@Pressacco的其他答案。它们可能会提供更好的结果。
原始答案 试一下:
那应该导致那些消息消失。
我将web.xsd保存在Web文件夹的根目录中(该文件夹可能不是放置它的最佳位置,而只是出于演示目的),并且Schemas属性如下所示:
“ C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ xml \ Schemas \ DotNetConfig.xsd”“ Web.xsd”