7

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 ?

  • I think it is still under proposal https://nuget.codeplex.com/workitem/1914 – Mohamed Farrag Apr 17 '15 at 15:08
  • This is not possible with the current version of NuGet. The locations of the files is defined by the NuGet package. – Matt Ward Apr 17 '15 at 16:15
  • http://stackoverflow.com/questions/4092759/is-it-possible-to-change-the-location-of-packages-for-nuget –  Apr 17 '15 at 23:08
  • @gerdi that question is about where *packages* install to, not about where the *content* of a package gets installed to. – Eilon Apr 18 '15 at 06:16

1 Answers1

4

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:

Community
  • 1
  • 1
Eilon
  • 25,582
  • 3
  • 84
  • 102
  • 1
    FYI: ASP.NET 5 will use Bower as the default package manager for cliend-side dependencies such as bootstrap, jQuery, etc. So, if you are working on a ASP.NET MVC project currently, you may have more reason to learn about this cool stuff. See: http://www.asp.net/vnext/overview/aspnet-vnext/grunt-and-bower-in-visual-studio-2015 – vxchin Apr 21 '15 at 03:13