I’m trying to implement the Styles.Render method in a project of mine and I am using the separate, pre-built MVC 4 internet application project that’s created from the New Project wizard as my model. In the pre-built MVC website’s _Layout.cshtml layout view, the following code appears within the head tag:
@Styles.Render("~/Content/css")
However, in my own project, just using the @Styles.Render syntax does not seem to work. For some reason, the view does not like it. And I have to resort to using the fully qualified version of the method:
@System.Web.Optmization.Styles.Render("~/Content/css")
I would like to know what am I missing or how can I avoid having to use the fully qualified type and member syntax from within a Razor view in the manner of the pre-built version as described above? Thanks.
You’re missing the System.Web.Optimization namespace reference in the web.config in the views folder