Search code examples
asp.net-mvcvisual-studionugetnuget-packagenuget-spec

How to change script or style files location from nuget?


I have a MVC project and I am using jquery, bootstrap and some other files from nuget. In mvc by default all of scripts files is in Scripts and all of css files is in Content as you know. I moved all scripts and css files to Content/css , Content/js , after that i got a problem because the files are going to the default location (js => Scripts, css=> Content) when i update my nuget packages.

So how can i solve this problem ? Is it possible ?


Solution

  • In NuGet it is not possible to control where content files get installed to. The author of the NuGet package decides entirely what path to use for content files.

    Instead of using NuGet for content files, I recommend using Bower, which is based on npm (the Node Package Manager).

    With Bower you can control where files get installed to. Check out this SO post on the subject (especially the second answer): How to change bower's default components folder?


    More info on Bower: