Viewbag.Title error: One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?

前端 未结 5 1653
生来不讨喜
生来不讨喜 2021-02-14 01:03

I have an ASP.NET MVC 5 web application. In every .cshtml view file i get the following error for Viewbag: One or more types required to compile a dynamic expre

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-14 01:43

    I hope this will help someone. Works for me in VS 2013 with asp.net MVC 5 and .NET 4.6.1

    Readding Microsoft.CSharp did not fix the problem. Also, adding System.Core to system.web/compilation/assemblies/ at web.config did not fix too.

    I overcame this only this adding System.Web.Mvc to system.web/compilation/assemblies/ section:

    
      
          
      
    
    

    Rebuilded the solution and red line disappeared.

提交回复
热议问题