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

老子叫甜甜 提交于 2019-11-30 04:41:45

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 :)

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!