A mvc project requires a project file and a packages file. Be sure the packages file is defined, and you did a nuget restore.
The name 'viewbag' does not exist in the current context
Working on an MVC solution developed by team member that was pulled from Team Foundation Server, and have many error messages in this solution like:
- The name 'viewbag' does not exist in the current context
- The name 'HTML' does not exist in the current context
- The type or namespace 'MVC' name does not exist in the namespace 'System.Web'
- The type or namespace 'ActionResults' could not be found.
- *** and many similar error messages
If I open another solution pulled from TFS, I don't get any of these types of syntax error messages.
Have checked the following to troubleshoot:
--I do have a web.config in my Views folder
--I've done multiple Cleans/Rebuild tries
--I've deleted files from C:\Users****\AppData\Local\Microsoft\VisualStudio\16.0_581ef021\ComponentModelCache
--Root web.config says <dependentAssembly> ... <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
2 answers
Sort by: Most helpful
-
-
CC 321 Reputation points
2021-06-25T14:38:13.92+00:00 I do have a packages.config file
I have these settings via Tools >> NuGet Package Manager >> Package Manager Settings: