I am having trouble defining generic models in razor views. Whenever I use a generic model, I get the following warning:
Unknown element 'string' or element cannot be placed here.
Example:
@model List<string>
While this doesn't cause any major errors, it's still very annoying. Is there a way to define a generic in a razor view that doesn't cause this warning?
Environment:
VS 2013
ASP.NET MVC v5.1.2
Razor 3.1.1
I was having the same problem, and it turns out that when I upgraded to the latest version of MVC, not all of my config elements were updated correctly. Changing Web.config in the following ways fixed this for me:
System.Web.Mvc
has the version number changed to 5.0.0.0
.System.Web.WebPages.Razor
has the version number changed to 3.0.0.0
.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