Bryuk Bryuk - 3 years ago 295
jQuery Question

How to add jQueryUI library in MVC 5 project?

I've just installed Visual Studio 2013 and started new MVC 5 project. I'm kind of new in MVC developing and I can't figure out how to add libraries in my project.

I see some similar parts. For example, on the

I have this code:


Then in the

<package id="Antlr" version="" targetFramework="net45" />
<package id="bootstrap" version="3.0.0" targetFramework="net45" />
<package id="EntityFramework" version="6.0.0" targetFramework="net45" />
<package id="jQuery" version="1.10.2" targetFramework="net45" />
<package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />

Then as far as I know something happens on

So, I've downloaded jQuery UI libraries with .js and css files. My question is:
Where and what should I add in term of use this libraries everywhere like default libraries (bootstrap or jquery)?
And jQuery UI has 3 folders with content. I added this folders with all content to my project, I just need to add references.

Answer Source

The code you see rendering css and scripts on your _Layout.cshtml page (i.e. @Scripts.Render("~/bundles/modernizr")) is called bundling. Check out some info here:

So, to add jQueryUI you would do the following:

In your Global.asax.cs file you should see a number of registrations:


This goes to the BundleConfig class whioch registers any bundles. For jQueryUI you could do the following:

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(

This is creating a new script bundle called ~/bundles/jqueryui.

Then it can be added to your layout page by doing this:


Then you'll do the same for css:

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(

and add it with



  • In MVC4, a non-empty project already has jQuery set up. FOr an empty project you would have to add it yourself. Not 100% sure about the new MVC 5.
  • You can install jQueryUi from nuget, but the official package doesn't add this bundling stuff.
  • You could just do the old fashioned referencing of you css and js files (e.g. <script language="JavaScript" src="~/Scripts/jQuery.ui.1.8.2.js" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download