.net - 如何解决 "Could not find schema information for the element/attribute <xxx>"?

标签 .net xml xsd enterprise-library

在 visual studio 中,我有一个使用 MS Enterprise Library 4.0 应用程序 block 的 asp.net 3.5 项目。

当我打开我的网络配置文件时,我的错误列表充满了 99 条消息,例如

Could not find schema information for the element 'dataConfiguration'.  
Could not find schema information for the attribute 'defaultDatabase'.  
Could not find schema information for the element 'loggingConfiguration'.   
Could not find schema information for the attribute 'tracingEnabled'.   
Could not find schema information for the attribute 'defaultCategory'.  

如果我关闭 Web.config 文件,它们就会消失(但只要我需要再次打开文件,它们就会回来)。

查看之后,我发现这是因为缺少 Visual Studio 需要的 XSD 或架构文件,以便正确“理解”web.config 文件中的架构并为其提供智能感知。

有谁知道如何为 VS 提供适当的架构信息,或者如何关闭这些消息?

@Franci - 感谢您提供信息,我已经尝试过该工具以及 MMC 管理单元(它们往往会破坏 Web.config 中的格式),但它们仍然无法解决我收到的恼人警告。感谢您的尝试。

最佳答案

我已经根据我当前的 app.config 创建了一个新方案来使消息消失。 我刚刚使用了 Visual Studio 中的“创建架构”按钮,并为我创建了一个 xsd 架构。

将模式保存在适当的位置,然后查看 app.config 文件的“属性”选项卡,其中有一个名为 Schemas 的属性。如果您单击那里的更改按钮,您可以选择同时使用原始的 dotnetconfig 架构和您自己新创建的架构。

关于.net - 如何解决 "Could not find schema information for the element/attribute <xxx>"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/179927/

相关文章:

html - 基于文本的跨度的 XPath?

java - UTC 或本地时间与我的模式的区域偏移量?

c# - 线程重命名

c# - 如何在 lambda 表达式参数中扩展谓词

c# - 从 UWP 应用程序窗口的 Windows.UI.Core.CoreWindow 获取 win32 消息

c# - 如何使用 XmlSerializer 反序列化大型文档中的节点

c# - 如何将 schemaLocation 属性添加到 XML 文档

c# - 将方法存储在数组中并在 C# 中调用它们

xml - 模式 1.1 的 lxml

java - 图形布局和运行时的奇怪问题