I know this error has been posted elsewhere, but the solutions provided don't work for me.

Background:

  • I created a brand new project using MVC3 with Razor syntax using Visual Studio 2010 SP1.
  • Everything works fine when I run the project locally.
  • I installed MVC3 on my remote server and deployed the project.

I get the following error:

Compiler Error Message: CS0103: The name 'ViewBag' does not exist in the current context
Source Error:
Line 1:  @model MyModels.AModel
Line 2:  @{
Line 3:      ViewBag.Title = "Home Page";
Line 4:  }
Line 5:  <script type="text/javascript">
  • I checked, and I do have a Web.Config file in my Views directory that appears to be complete.
  • This is not an upgraded solution. I did not go from a previous MVC beta to the final release.
  • I'm going crazy at this point. I'll be happy to provide more information if requested.
Edit
Report