"Unknown element" in Strongly typed View with Generic Model

asp.net, asp.net-mvc, razor

Solution

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:

- Make sure any line mentioning `System.Web.Mvc` has the version number changed to `5.0.0.0`.

- Make sure any line mentioning `System.Web.WebPages.Razor` has the version number changed to `3.0.0.0`.

Problem

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

Original source