Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.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
C# 为什么VS2015RC会说;ViewBag没有';“不存在于当前上下文中”;,正如VS2013所说,哪里没有错误?_C#_Asp.net Mvc 4_Razor_Visual Studio 2013_Visual Studio 2015 - Fatal编程技术网

C# 为什么VS2015RC会说;ViewBag没有';“不存在于当前上下文中”;,正如VS2013所说,哪里没有错误?

C# 为什么VS2015RC会说;ViewBag没有';“不存在于当前上下文中”;,正如VS2013所说,哪里没有错误?,c#,asp.net-mvc-4,razor,visual-studio-2013,visual-studio-2015,C#,Asp.net Mvc 4,Razor,Visual Studio 2013,Visual Studio 2015,我在VS2013和VS2015RC中打开了相同的MVC解决方案,代码完全相同,但我的VS2015RC告诉我,在我的.cshtml页面上存在大量错误,而VS2013则表示没有错误。主要问题是,由于VS2015中的错误,我无法获得任何智能感知 这可能是什么原因造成的?另外,当我在VS2015中构建解决方案时,它说它成功了? 代码段: <!DOCTYPE html> <html> <head> <title>@ViewBag.Title<

我在VS2013和VS2015RC中打开了相同的MVC解决方案,代码完全相同,但我的VS2015RC告诉我,在我的.cshtml页面上存在大量错误,而VS2013则表示没有错误。主要问题是,由于VS2015中的错误,我无法获得任何智能感知

这可能是什么原因造成的?另外,当我在VS2015中构建解决方案时,它说它成功了? 代码段:

<!DOCTYPE html>

<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-2.1.3.min.js")" type="text/javascript"></script>
    <meta name="description" content="The description of my page" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
    <div id="header">
        <div class="title">ABC</div>
    </div>
    <div id="categories">
        @{ Html.RenderAction("Menu", "Navigation"); }
    </div>
    <div id="content">
        @RenderBody()
    </div>
</body>
</html>

@视图包。标题
基础知识
@{Html.RenderAction(“菜单”、“导航”);}
@RenderBody()
vs2013
vs2015

尝试在每个.cshtml中添加这一行

@inherits System.Web.Mvc.WebViewPage<dynamic>
@继承System.Web.Mvc.WebViewPage

我不确定这一个,但我用剃须刀也有类似的问题。我不得不删除所有的参考资料,并通过nuget读取它们。如果dll不兼容,这可能会起作用;选中[System.Web.Mvc],因为这是定义ViewBag的地方。是否可能重复?