Web.config文件转换:无法识别的属性'的xmlns:XDT“。请注意,属性名称是区分大小写 [英] Web.config transformation: Unrecognized attribute 'xmlns:xdt'. Note that attribute names are case-sensitive

查看:1063
本文介绍了Web.config文件转换:无法识别的属性'的xmlns:XDT“。请注意,属性名称是区分大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MVC 3.0项目得到这个奇怪的错误间歇性
当我生成项目有时我得到以下错误信息:


  

无法识别的属性'的xmlns:XDT。请注意,属性名
  区分大小写。


这是指标准的web.config文件穿越 - (Web.Release.config下面复制)
有没有其他的错误或警告。这是发生在调试模式和释放。
有时它清除,如果我清洁解决方案

开始更新

发现的问题。在MVC项目文件(MyProject.csproj)我已成立创建视图为true

 < MvcBuildViews>真< / MvcBuildViews>

一旦放回上述错误消失。我想有视图生成,它停止了很多愚蠢的看法code错误等,是一种性能增强(页面pcompiled代替JIT $ P $)

任何人都知道这是什么原因造成的错误?这是一个错误?

END更新

 <?XML版本=1.0&GT?;<! - 有关使用Web.config文件转化访问http://go.microsoft.com/fwlink/?LinkId=125889更多信息 - ><结构的xmlns:XDT =htt​​p://schemas.microsoft.com/XML-Document-Transform>
  <! -
    在下面的例子中,SetAttributes变换将改变的值
    的connectionString用ReleaseSQLServer只有当匹配定位器
    发现一个atrribute姓名具有MYDB的值。    <&是connectionStrings GT;
      <添加名称=MYDB
        的connectionString =数据源= ReleaseSQLServer;初始目录= MyReleaseDB;集成安全性=真
        XDT:转换=SetAttributesXDT:定位器=匹配(名称)/>
    < /&是connectionStrings GT;
   - >
  <&的System.Web GT;
    <编译XDT:转换=RemoveAttributes(调试)/>
    <! -
      在下面的例子中,替换改造将替换整个
      <&的customErrors GT; Web.config文件的部分。
      注意,因为下唯一的customErrors部
      <&的System.Web GT;节点,也没有必要使用XDT:定位器属性。      <的customErrors的defaultRedirect =GenericError.htm
        模式=仅限远程XDT:转换=替换>
        <错误状态code =500重定向=InternalError.htm/>
      < /&的customErrors GT;
     - >
  < /system.web>
< /结构>


解决方案

我碰到了同样的问题。
你会发现很多的玩笑在那里与MvcBuildViews和各种错误条件。
但似乎没有提到这个特殊的错误。
速战速决的工作对我来说是删除目标文件目录中的内容为受影响的Web项目,然后重新生成。

I'm getting this strange intermitent bug in a MVC 3.0 project When I build the project sometimes I get the following error message:

Unrecognized attribute 'xmlns:xdt'. Note that attribute names are case-sensitive.

This is referring to the standard web.config tranformation file (Web.Release.config copied below) There are no other errors or warnings. This is happening in debug mode and release. Sometimes it clears if I clean the solution

BEGIN UPDATE

Found the issue. In the MVC Project file (MyProject.csproj) I had set build views to true

<MvcBuildViews>true</MvcBuildViews>

Once put back to false the above error goes away. I'd like to have the view build as it stops alot of stupid view code errors etc and is a performance enhancement (pages are precompiled instead of jit)

Anyone know what this is causing the error? is this a bug?

END UPDATE

<?xml version="1.0"?>

<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an atrribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB" 
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <!--
      In the example below, the "Replace" transform will replace the entire 
      <customErrors> section of your Web.config file.
      Note that because there is only one customErrors section under the 
      <system.web> node, there is no need to use the "xdt:Locator" attribute.

      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>
</configuration>

解决方案

I ran into the very same problem. You will find lots of banter out there related to MvcBuildViews and various error conditions. But none seem to mention this particular error. A quick fix that worked for me was to delete the contents of the "obj" directory for the affected web project, then rebuild.

这篇关于Web.config文件转换:无法识别的属性'的xmlns:XDT“。请注意,属性名称是区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆