asp.net mvc - @Styles.Render & @Scripts.Render won't work in Empty MVC Visual Studio solution -


if create solution mvc 5 template in vs 2015 - bundling & minification works fine.

if create solution empty template folders , core references mvc - bundling & minification won't work.

these not work in razor view:

@styles.render("~/content/css") @scripts.render("~/bundles/modernizr") 

(error: name 'styles' not exist in current context).

i have tried installing nuget package - doesn't help:

install-package microsoft.aspnet.web.optimization 

any references in google appear apply older versions, , above nuget package.

how supposed add bundling & minification project doesn't have it? there different nuget package or something?

first need ensure have reference system.web.optimization in web project styles static class exists. after need ensure namespace available in views. this, edit web.config in views folder , add namespace

<system.web.webpages.razor>     <pages>         <namespaces>             ....             <add namespace="system.web.optimization"/>             ^^^^^^^^^^^^^^ add line ^^^^^^^^^^^^^         </namespaces>     </pages> </system.web.webpages.razor> 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo