“ViewBag'这个名字并不在目前的情况下存在 [英] The name 'ViewBag' does not exist in the current context

查看:145
本文介绍了“ViewBag'这个名字并不在目前的情况下存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中使用ViewBag,我有所有的最近的dll,MVC 3的最新版本,但尚未我仍然得到了错误:'ViewBag'的名称在当前情况下不存在。

I am trying to use ViewBag in my application, I have all of the recent dlls, the latest version of MVC 3, but yet I am still getting the Error: "The name 'ViewBag' does not exist in the current context".

我甚至卸载,然后重新安装MVC 3,但没有任何改变。

I have even uninstalled and then re-installed MVC 3 and yet there is no change.

另外,我不相信DLL的都出现在GAC了。

Also, I do not believe that the dll's are showing up in the GAC.

任何一个知道我的问题可能是什么?或如何添加DLL的到GAC?

Any one know what my problem might be? Or how to add the dll's to the GAC?

推荐答案

您需要特定的MVC-剃刀配置添加到你的web.config。看这里:<一href=\"http://stackoverflow.com/questions/4136703/razor-htmlhelper-extensions-not-found/4136773#4136773\">Razor扩展的HtmlHelper未找到

You need to add the MVC-specific Razor configuration to your web.config. See here: Razor HtmlHelper Extensions Not Found

使用 MVC 3升级工具自动确保你有合适的配置值。

Use the MVC 3 upgrade tool to automatically ensure you have the right config values.

这篇关于“ViewBag'这个名字并不在目前的情况下存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆