CS0012:类型“System.Xml.IXmlLineInfo” [英] CS0012: The type 'System.Xml.IXmlLineInfo'
本文介绍了CS0012:类型“System.Xml.IXmlLineInfo”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个.aspx页面(使用MVC 2)
当我试图使一个ActionLink的我得到一个错误(可以参见下文)。这code已经工作,但因为我更新了我的项目(这是一个Silverlight项目)到.NET 4.0它给我的错误。
错误:
CS0012:类型System.Xml.IXmlLineInfo在未被引用的程序集中定义。您必须添加一个引用程序集的System.Xml,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e。
code:
< UL>
<%的foreach(在dossier.Flows VAR项){%GT;
<李标题='<%= item.Name%> >
&其中;如果%(item.Name.Length→30)item.Name = item.Name.Substring(0,30); %>
<%= Html.ActionLink(item.Name,索引,主,新{令牌= Model.Token,dossiersId = dossier.Id,usersId = Model.usersId,flowsid = item.Id},空)% >
< /李>
<%}%GT;
< / UL>
别人谁知道该怎么办?或收到这个问题,并修复它?
固定它是这样的:
< UL>
<%的foreach(在dossier.Flows VAR项){%GT;
&所述;% - &其中;如果%(item.Name.Length→20)%> - %GT;
<李标题='<%= item.Name%> >
&其中;如果%(item.Name.Length→30)item.Name = item.Name.Substring(0,30); %>
&所述; A HREF ='&其中;%= item.IntranetLink%GT;'> &所述;% - &其中; HREF>&其中;%= Model.IntranetUrl%GT;&所述; / HREF> - %GT;
&其中;%= item.Name%GT;
&所述; / a取代;
<% - <%= Html.ActionLink(item.Name,索引,主,新{令牌= Model.Token,dossiersId = dossier.Id,usersId = Model.usersId,flowsid = item.Id },空)%> - %GT;
< /李>
<%}%GT;
< / UL>
解决方案
这是因为在编译过程中缓存的参考。请参阅此博客
I have an .aspx page (using MVC 2)
When i'm trying to make an actionlink i get an error (you can see below). This code worked already, but since i updated my project (it's a silverlight project) to .net 4.0 it gives me that error..
Error:
CS0012: The type 'System.Xml.IXmlLineInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Code:
<ul>
<% foreach (var item in dossier.Flows){%>
<li title='<%=item.Name %>' >
<%if (item.Name.Length > 30) item.Name = item.Name.Substring(0, 30); %>
<%= Html.ActionLink(item.Name, "Index", "Main" , new { token = Model.Token, dossiersId = dossier.Id, usersId = Model.usersId, flowsid = item.Id }, null)%>
</li>
<%} %>
</ul>
someone who knows what to do? or had this problem before and fixed it?
Fixed it on this way:
<ul>
<% foreach (var item in dossier.Flows){%>
<%-- <%if(item.Name.Length > 20) %>--%>
<li title='<%=item.Name %>' >
<%if (item.Name.Length > 30) item.Name = item.Name.Substring(0, 30); %>
<a href='<%=item.IntranetLink %>'> <%-- <href><%= Model.IntranetUrl %></href>--%>
<%= item.Name %>
</a>
<%--<%= Html.ActionLink(item.Name, "Index", "Main" , new { token = Model.Token, dossiersId = dossier.Id, usersId = Model.usersId, flowsid = item.Id }, null)%>--%>
</li>
<%} %>
</ul>
解决方案
It is because of cached reference during compilation. Refer this blog
这篇关于CS0012:类型“System.Xml.IXmlLineInfo”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文