类型"System.Web.IHtmlString"在未引用的程序集中定义

编程入门 行业动态 更新时间:2024-10-28 12:31:24
本文介绍了类型"System.Web.IHtmlString"在未引用的程序集中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

现在有点失落了...

Little lost right now...

我正在关注以下文章,以测试/学习嵌套布局. blogs.msdn/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx

I am following the following article to test/learn nested layouts. blogs.msdn/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx

我收到以下错误:

The type 'System.Web.IHtmlString' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. D:\Projects\Mvc3\Tests\RazorLayouts\Layout.MvcBase\Extensions\SectionExtensions.cs 15 36 Layout.MvcBase

我有名称空间System.Web引用了...,蓝线在"RenderSection"上. 公共静态HelperResult RenderSection

I have name space System.Web referenced... and the blue line is on "RenderSection". public static HelperResult RenderSection

推荐答案

我刚刚遇到了这个问题.您可能还需要添加对" System.Web "的引用.这为我解决了.请记住,不仅是"using"语句,而且实际上是添加了对它的引用.在为控制器设置测试项目时遇到了这个问题.

I just had this issue. You may need to add a reference to "System.Web" as well. That fixed it for me. Remember, not just the "using" statement, but actually adding a reference to it. I ran into this issue while setting up a test project for my controllers.

更多推荐

类型"System.Web.IHtmlString"在未引用的程序集中定义

本文发布于:2023-11-06 04:56:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义   类型   程序   quot   Web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!