在 3 台全新安装 VS 2015 RTM 的 PC 上遇到此问题。在 VS 2013 中打开文件时没有问题。Fix: The Global element 'configuration' has already been declared 中描述的步骤和其他相关问题无济于事,因为 VS 会忽略 XML 模式对话框中的任何更改。想法?
最佳答案
不幸的是,有许多情况会导致此问题。
最有可能的问题是文档的架构设置不正确。当您在计算机上安装较新版本的 .NET 和/或 Visual Studio 时,可能会发生这种情况。不过修复很简单。
来自Visual Studio documentation :
- Open a file in the XML editor.
In the document properties window, click the button on the Schemas field.
The XML Schemas dialog box is displayed. The dialog box lists all schemas with an .xsd extension in the schema cache (including schemas referenced in the catalog.xml file), and also any schema that is in the current solution, open in Visual Studio, referenced in an xsd:schemaLocation attribute, or referenced in the Schemas property.
- Select the schemas to use for validation by doing one of the following:
- Select a schema listed in the XML Schemas dialog, click the Use column, and then select Use this schema. -OR-
- Select multiple schemas listed in the XML Schemas dialog, right-click and select Use this schema.
- Click OK.
具体来说,您希望将“DotNetConfig.xsd”架构的“使用”列设置为“自动”。
关于xml - VS 2015 RTM web.config 全局元素 'configuration' 已经声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31540122/