2

我已经出现在我的Visual Studio错误列表如下,颇为愤怒,警告:的Visual Studio - 禁止的web.config警告

The element 'behavior' has invalid child element 'silverlightFaults'. List of possible elements expected: 'clientVia, callbackDebug, callbackTimeouts, clear, clientCredentials, transactedBatching, dataContractSerializer, dispatcherSynchronization, remove, synchronousReceive, enableWebScript, webHttp, endpointDiscovery, soapProcessing'.

它的web.config起源。该应用程序编译好,我只是想压制错误。

什么不起作用:

  • 右键单击>禁止(这不是一个FxCop的错误)
  • 在构建窗口定位的警告标识,并通过项目属性对话框supressing它(警告不在构建窗口中显示)。

有没有办法隐藏这个警告,还是我必须忍受它?

回答

3

找到解决方案。您可以更新架构文件VS再次验证以摆脱警告。它只适用于你的本地电脑,但如果你对我自己的警告保持肛门保留,这是值得的。

  • 打开Visual Studio中的模式文件位于:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas\DotNetConfig.xsd

  • 点击打开XML架构资源管理

  • 找到节点系统的链接。 serviceModel \ behaviors \ endpointBehaviors \行为并双击它。

XML Schema Explorer

这将带你在架构文件有问题的区域,这与开始的:低于

<xs:element name="behavior" vs:help="configuration/system.serviceModel/behaviors/endpointBehaviors/behavior">

两条线,你会看到:

<xs:choice minOccurs="0" maxOccurs="unbounded">

在该节点内部是您要添加有问题的元素的位置。就我而言,我增加了以下内容: <xs:element name="silverlightFaults"> </xs:element>

  • 保存文件,导航回到web.config中,看到的警告了。

当然,在出现任何问题之前,请确保先备份文件。