针对当前 RC2 - 生成的 Razor View 模板包括:
@{
ViewBag.Title = "Details1";
Layout = "/Views/Shared/_Public.cshtml";
}
ViewBag.Title 下有红色波浪线,并且出现此编译器错误:'
Error 4 One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll? c:\Visual Studio 2010\Projects\myProj\Views\Webinar\Details1.cshtml 6 2 TTSTrain.Webinars.WebEntry
但是该项目可以正常构建并运行。该错误是否表明存在其他需要解决的问题?
最佳答案
删除targetFramework
后我遇到了同样的问题来自 <compilation>
的属性Web.config 文件中的元素。
一旦我将其恢复为
<compilation debug="true" targetFramework="4.0">
一切又恢复正常了!
关于asp.net-mvc-3 - ViewBag.Title 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4605263/