Reputation: 1889
I am developing a web application in MVC5.
And I am trying to use model in View as shown in snapshot -
Faced problem for model too. I tried some solutions as (but none fixed it) -
(1) Delete all files of folder at location E:\Users\V.S. Saini\AppData\Roaming\Microsoft\VisualStudio\11.0\ReflectedSchemas based on root drive and the Visual Studio version installed.
Since I am using VS 2012, so the path is.
(2) There was a solution suggesting upgrade of razor version from 2.0 to 3.0 in web.config in Views. But not worked.
Could you please help me to fix this issue?
Upvotes: 2
Views: 4418
Reputation: 39
First of all you need to know it's not an error!
Steps to resolve the warning message for an element.
enter image description here enter image description here
That's it, you are done...
Upvotes: 0
Reputation: 1889
Well! It was daunting task to fix this issue.
First of all this mess was created due to updating different MVC related references (v4 to v5) from Nuget Package Manager in VS 2012.
(1) The first and utmost task is to cross-check your existing web.config (both in root and Views folder) as per the link How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2.
(2) Then downloaded the update at link ASP.NET and Web Tools 2013.1 for Visual Studio 2012. Close all Visual Studio instances and then run this update.
(3) Open Visual Studio and re-build MVC solution.
Wow! The squiggy error line got removed and VS started recognizing razor keywords. :)
Upvotes: 3
Reputation: 16595
I'm thinking it's Visual Studio isn't picking up that @model
is a special Razor keyword. The entire @model
is normally highlighted yellow. And then List
shouldn't be black to match the text color, it should be the color for classes.
Have you tried running Visual Studio in safe mode to see if a plugin or extension is causing this issue? As you stated in your comment, it probably isn't harming anything, but it probably is annoying.
Upvotes: 1