开发者

CS0012: The type 'System.Xml.IXmlLineInfo'

开发者 https://www.devze.com 2023-01-16 21:35 出处:网络
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

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>

  开发者_JS百科                      <%--<%= Html.ActionLink(item.Name, "Index", "Main" , new { token = Model.Token, dossiersId = dossier.Id, usersId = Model.usersId, flowsid = item.Id }, null)%>--%>
                        </li>
                    <%} %>
                </ul>


That problem is covered here: Strange Error - CS0012: The type x is defined in an assembly that is not referenced


It is because of cached reference during compilation. Refer this blog

0

精彩评论

暂无评论...
验证码 换一张
取 消