Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding the "Microsoft.jQuery.Unobtrusive.Validation" package asks for jQuery 1.4.1?

In one of the projects I needed to reinstall the jQuery NuGet package (a MVC solution).

There were also a "Microsoft.jQuery.Unobtrusive.Validation", that I should uninstall before removing the jQuery package.

Now I try to (re)install the jQuery package, and all dependent packages I removed before. The "Microsoft.jQuery.Unobtrusive.Validation" package breaks saying:

Attempting to resolve dependency 'jQuery (≥ 1.8)'.
Attempting to resolve dependency 'jQuery.Validation (≥ 1.8)'.
Attempting to resolve dependency 'jQuery (≥ 1.3.2 && ≤ 1.6)'.
Updating 'jQuery 1.8.0' to 'jQuery 1.4.1' failed.
Unable to find a version of 'Microsoft.jQuery.Unobtrusive.Validation' that is compatible with 'jQuery 1.4.1'.

was is das? I need to use the latest jQuery (2.0.xx)!

I should remark that the similar "Microsoft.jQuery.Unobtrusive.Ajax" package does not have this 'bug'. It was installed without problems.

PS. Now I tried to install the (non-Microsoft)jQuery.Validation...

this is the error log:

Attempting to resolve dependency 'Microsoft.jQuery.Unobtrusive.Validation (≥ 2.0.20613.0)'.
Attempting to resolve dependency 'jQuery.Validation (≥ 1.8 && < 2.0)'.
Attempting to resolve dependency 'jQuery (≥ 1.3.2 && ≤ 1.6)'.
Installing 'jQuery 1.4.1'. Successfully installed 'jQuery 1.4.1'.
Installing 'jQuery.Validation 1.8'.
Successfully installed 'jQuery.Validation 1.8'.
Installing 'Microsoft.jQuery.Unobtrusive.Validation 2.0.20710.0'.
Successfully installed 'Microsoft.jQuery.Unobtrusive.Validation 2.0.20710.0'.
Installing 'jQuery.Validation.Unobtrusive 2.0.20710.0'.
Successfully installed 'jQuery.Validation.Unobtrusive 2.0.20710.0'.
Install failed.
Rolling back...
Updating 'jQuery 1.9.0' to 'jQuery 1.4.1' failed. Unable to find versions of 'bootstrap, jQuery.BlockUI, Microsoft.jQuery.Unobtrusive.Ajax' that are compatible with 'jQuery 1.4.1'.

like image 517
serhio Avatar asked Feb 26 '14 15:02

serhio


3 Answers

I just ran into this same issue now.

Using NuGet I added "jQuery", then "jQuery Validatation" Tried "Microsoft jQuery Unobtrusive Validation" again, this time it installed nicely :)

like image 182
Dragick Avatar answered Nov 02 '22 12:11

Dragick


jQuery 1.x and jQuery 2.x are two separate branches of jQuery. jQuery 1.x continues to have support for older versions of IE (6/7/8), while 2.x does not. In essence, there are two "latest" versions of jQuery.

jQuery validation is not currently tested with the 2.x branch and currently lists 1.6.4, 1.7.2, 1.8.3, 1.9.1, 1.11.1 as supported/tested. It may work fine with jQuery 2.x, but as it doesn't technically currently support it. I have been sticking with the latest jQuery 1.x version because of this.

How do you fix this?

In order to fix this issue, switch to the latest jQuery 1.x version (currently 1.11.1) by typing the following command in your Package Manager Console to update the reference from 2.x to 1.11.1.

Install-Package jQuery -Version 1.11.1

Like @Dragick said previously there is a weird dependency issue where Microsoft.jQuery.Unobtrusive.Validation nuget can't determine the jQuery version if you try to directly install it without already having jQuery.Validation nuget installed. To fix this, install them separately like the following:

Install-Package jQuery.Validation
Install-Package Microsoft.jQuery.Unobtrusive.Validation
like image 45
scottheckel Avatar answered Nov 02 '22 11:11

scottheckel


Same issue here. I left the jQuery 2.1.0 package installed then installed jQuery Validate next, then installed jQuery Unobtrusive and it worked.

like image 22
Chris Morgan Avatar answered Nov 02 '22 10:11

Chris Morgan