1

I'm building an empty ASP.NET MVC4 project and I'm a little confuse with the jQuery versions that NuGet install in the application.

Well, when I installed the jQueryValidation, the NuGet installed the jQuery version 1.4.4. Then when I installed jQueryUnobtrusive, the NuGet installed the jQuery 1.8.0. Now my application is using two versions of jQuery and I don't know if I should keep two versions or keep the latest (Can I go to the jQuery site and download the latest version, that today is the 1.11.3?)

GoldShip
  • 139
  • 1
  • 9

2 Answers2

1

Check the requirements of each package, and find the latest version of jQuery that meets all of the packages' requirements.

And no, it is not a good idea to have multiple versions of jQuery loaded on your site, as there could (will?) be conflicts.

user145400
  • 1,076
  • 1
  • 12
  • 27
1

Each package likely upgrades you to the minimum required for that package. As long as any given package doesn't have a maximum supported version, using the latest would usually be advisable.

For example, if the default project template shipped with something earlier than 1.4.4 and the jQuery Validation package requires 1.4.4, it would install that dependency as part of the NuGet package management. Later installing another package which requires a higher version would do the same.

If you upgrade jQuery itself via NuGet, those packages won't need to install their own required versions because you'd already have a higher one. (Unless any given package has a maximum version, in which case I'm not really sure what NuGet would do.)

Simultaneously referencing more than one would not be advisable. Though it is possible and can be done as a workaround for a dependent library which has an earlier maximum version. But it's rare that you'd want to do that, and often easier to just settle on that library's maximum version as your standard.

For example, if Library X doesn't work with jQuery > 1.8.0 and Library Y doesn't work with jQuery < 1.9.0 then you can't satisfy both libraries with a single version of jQuery. In this case if you need to use both libraries then you can use both versions of jQuery to support them. It's likely that you wouldn't want to do that, though.

Community
  • 1
  • 1
David
  • 208,112
  • 36
  • 198
  • 279