类型"System.Web.IHtmlString"在未引用的程序集中定义 [英] The type 'System.Web.IHtmlString' is defined in an assembly that is not referenced
问题描述
现在有点失落了...
Little lost right now...
我正在关注以下文章,以测试/学习嵌套布局. http://blogs.msdn.com/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx
I am following the following article to test/learn nested layouts. http://blogs.msdn.com/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"在未引用的程序集中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!