Saturday, April 6, 2019

asp.net mvc - Upgraded to MVC 3: CS0103: The name 'View' does not exist in the current context



I have just updated to ASP.NET MVC 3 RC2.



The sample app I am working on now produces the following error, whenever a cshtml view is rendered:




CS0103: The name 'View' does not exist in the current context



It fails on the line:



@{
View.Title = "MyView";
}



... and fails anywhere else it encounters View in the code on the Razor file.



I have copied the web.config from a new apps View folder to my sample app, but the problem persists.



A brand new application runs without problems.



I have also rebuilt the solution, run Clean Solution. No joy.



I haven't worked on the sample for a few days. So it might be an issue that has nothing to do with RC2...


Answer




It's been renamed 'ViewBag'. You can read more about the changes from RC1 -> RC2 here


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...