0

我正在尝试在我的应用程序上实现 NHaml 视图,并且一切正常。但奇怪的是,在发布应用程序时,我在 web.config 文件上收到了一些警告。

我的 nhaml 参数是:

<configSections>
  ...
  <section name="nhaml" type="NHaml.Configuration.NHamlConfigurationSection, NHaml"/>
</configSections>
<nhaml autoRecompile="true" templateCompiler="CSharp3" encodeHtml="false" useTabs="false" indentSize="2">
  <assemblies>
    <add assembly="MyApp"/>
  </assemblies>
  <namespaces>
    <add namespace="MyApp" />
    <add namespace="MyApp.Controllers" />
  </namespaces>
</nhaml>

所以,这很奇怪,因为 haml 视图的渲染没有任何问题,但是每次打开 web.config 文件时,我都会收到以下警告:

Message 1   Could not find schema   information for the element   'nhaml'.            C:\inetpub\MyApp\Web.config 25  4   MyApp
Message 2   Could not find schema   information for the attribute 'autoRecompile'.    C:\inetpub\MyApp\Web.config 25  10  MyApp
Message 3   Could not find schema   information for the attribute 'templateCompiler'. C:\inetpub\MyApp\Web.config 25  31  MyApp
Message 4   Could not find schema   information for the attribute 'encodeHtml'.       C:\inetpub\MyApp\Web.config 25  58  MyApp
Message 5   Could not find schema   information for the attribute 'useTabs'.          C:\inetpub\MyApp\Web.config 25  77  MyApp
Message 6   Could not find schema   information for the attribute 'indentSize'.       C:\inetpub\MyApp\Web.config 25  93  MyApp
Message 7   Could not find schema   information for the element   'assemblies'.       C:\inetpub\MyApp\Web.config 26  6   MyApp
Message 8   Could not find schema   information for the element   'add'.              C:\inetpub\MyApp\Web.config 27  8   MyApp
Message 9   Could not find schema   information for the attribute 'assembly'.         C:\inetpub\MyApp\Web.config 27  12  MyApp
Message 10  Could not find schema   information for the element   'namespaces'.       C:\inetpub\MyApp\Web.config 29  6   MyApp
Message 11  Could not find schema   information for the element   'add'.              C:\inetpub\MyApp\Web.config 30  8   MyApp
Message 12  Could not find schema   information for the attribute 'namespace'.        C:\inetpub\MyApp\Web.config 30  12  MyApp
Message 13  Could not find schema   information for the element   'add'.              C:\inetpub\MyApp\Web.config 31  8   MyApp
Message 14  Could not find schema   information for the attribute 'namespace'.        C:\inetpub\MyApp\Web.config 31  12  MyApp

难道我做错了什么?

感谢您的关注。:)

4

1 回答 1

0

似乎这些只是 VS 告诉您在 XSD 中找不到自定义元素,因为它认为配置文件应该是什么样子。同样的情况也发生在 nhibernate 上。

所以你没有做错任何事,你可以忽略这些消息。它们只是提供信息。

基于这篇博 文 http://fgheysels.blogspot.com/2006/04/net-20-could-not-find-schema.html

我可以为配置创建一个 nhaml XSD(与 nhibernate 的人一样),但它在我的优先级列表中并不高。如果这些消息真的让您烦恼,请随意尝试一下。

于 2009-09-18T08:00:15.293 回答