Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Mvc4网站已生成,但在查看Razor文件时会填充错误列表_Asp.net Mvc_Visual Studio 2012_Intellisense - Fatal编程技术网

Asp.net mvc Mvc4网站已生成,但在查看Razor文件时会填充错误列表

Asp.net mvc Mvc4网站已生成,但在查看Razor文件时会填充错误列表,asp.net-mvc,visual-studio-2012,intellisense,Asp.net Mvc,Visual Studio 2012,Intellisense,我有一个Mvc4网站,构建和运行都很好,但在VS2012中查看时,每个Razor内容页面都充满了错误。我得到的错误是,model关键字和ViewBag对象不存在,Intellisense只拾取Html.TextBox和Html.Hidden,而不是Html.HiddenFor或Html.TextBoxFor 我猜想Web.Config节点中没有任何内容被intellisense注册;有人知道如何让这些名称空间重新正确注册吗?在Views/Web.config中没有指定的版本,这似乎是个问题。下面

我有一个Mvc4网站,构建和运行都很好,但在VS2012中查看时,每个Razor内容页面都充满了错误。我得到的错误是,
model
关键字和ViewBag对象不存在,Intellisense只拾取
Html.TextBox
Html.Hidden
,而不是
Html.HiddenFor
Html.TextBoxFor


我猜想Web.Config节点中没有任何内容被intellisense注册;有人知道如何让这些名称空间重新正确注册吗?

在Views/Web.config中没有指定的版本,这似乎是个问题。下面是更新的配置部分现在的样子:

<configuration>
    <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
            <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
    </configSections>
</configuration>


它们是否已在web.config
名称空间
部分注册?是否可以添加视图代码?