My current development environment:
Project Configuration:
I have looked through several threads, blogs for example ViewBag does not exist in the current context - Visual studio 2015
But my *.cshtml page shows few errors relevant to Razor
I have
C:\Users\your.name.here\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
System.Web.Mvc, Version=5.2.2.0
Still no result. But when I create a brand new project this error does not appear. Any clue?
FYI, Error or not the solution builds and runs without any drama.
Check your ~/Views/web.config
for the following settings.
<configuration>
<system.web.webPages.razor>
<pages pageBaseType="System.Web.Mvc.WebViewPage">
...
</pages>
</system.web.webPages.razor>
</configuration>
This is required for Visual Studio to recognize the types in your razor views.
Also ,
a. Unload and reload the project from the solution
b. Clean the solution
c. Exit Visual Studio, delete .user file in the project folder.
d. Open the solution again and build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With