0

The same ASP.NET MVC project pulled from GitHub compiles without any errors in my friend's PC but in mine, only in Razor View files (.cshtml) I get multiple errors like:

The name 'ViewBag' does not exist in the current context
The name 'Scripts' does not exist in the current context
The name 'Styles' does not exist in the current context

Since I thought it was regarding config files I deleted and cloned the project but still the same. The project will run fine though. But because of this problem I cannot get proper IntelliSense in development.


Update:

For some weird reason if I change System.Web.Mvc version to 5.0.0.0 in my PC then errors in View go away.

<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

But why?

Any help will be really appreciated.

lbrahim
  • 3,710
  • 12
  • 57
  • 95
  • [The name viewbag does not exist in the current context](http://stackoverflow.com/questions/4960148/the-name-viewbag-does-not-exist-in-the-current-context) ? – Yuliam Chandra Aug 21 '14 at 08:59
  • If there is a problem with `web.config` then it should not work on my friend's PC either. – lbrahim Aug 21 '14 at 09:02
  • try to restart the visual studio, delete `.user` or `.suo` file, and rebuild – Yuliam Chandra Aug 21 '14 at 09:04
  • @YuliamChandra There is `.user` file and deleting `.suo` and rebuilding did not work. – lbrahim Aug 21 '14 at 09:10
  • It is a `web.config` error or the target framework is wrong. Right click your project's properties, change the target framework to whichever it should be. – devqon Aug 21 '14 at 09:13
  • I mentioned that everything between my friend's PC and mine are exactly the same. – lbrahim Aug 21 '14 at 09:36

0 Answers0