我的控制台应用程序中的 app.config 文件出现了这个问题。
这是我的 app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="PROJECTNAME.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<PROJECTNAME.Properties.Settings>
<setting name="SETTING1" serializeAs="String">
<value>stringvariable</value>
</setting>
<setting name="SETTING2" serializeAs="String">
<value>boolvariable</value>
</setting>
<setting name="SETTING3" serializeAs="String">
<value>intvariable</value>
</setting>
</PROJECTNAME.Properties.Settings>
</userSettings>
</configuration>
如果我只有默认架构 (DotNetConfig.xsd),我会收到以下警告:
Message 1 Could not find schema information for the element 'userSettings'. PROJECTPATH\App.config
Message 2 Could not find schema information for the element 'PROJECTNAME.Properties.Settings'. PROJECTPATH\App.config
Message 3 Could not find schema information for the element 'setting'. PROJECTPATH\App.config
Message 4 Could not find schema information for the attribute 'name'. PROJECTPATH\App.config
Message 5 Could not find schema information for the attribute 'serializeAs'. PROJECTPATH\App.config
Message 6 Could not find schema information for the element 'value'. PROJECTPATH\App.config
消息 3-6 重复了 3 次。
如果我然后转到 XML > Create schema,它会创建一个 app.xsd 但它会给我另一个警告:
Warning 1 The global element 'configuration' has already been declared. App.xsd
这几天我一直在尝试解决这个问题,但没有任何结果。而且我找不到使用 Google 的解决方案