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

node.js - How do I prevent MongoDB replica set from querying the primary? -

c# - Randomly pick a specific int from a 2D Array -

php - Angularjs http.delete is not working after deploying project on server -