我可以将 Nuget 保留在 jQuery 1.9.x/1.x 路径上(而不是升级到 2.x)吗? [英] Can I keep Nuget on the jQuery 1.9.x/1.x path (instead of upgrading to 2.x)?

查看:11
本文介绍了我可以将 Nuget 保留在 jQuery 1.9.x/1.x 路径上(而不是升级到 2.x)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像大多数人一样,我使用 jQuery Nuget 包 来保持最新状态.

Like most people, I'm using the jQuery Nuget package to keep up to date.

但是,随着 jQuery 2.0 的发布,我现在被提示将 jQuery 1.9.1 升级到 2.0.目前,我的网站上有足够的访问者使用古老"版本的浏览器,我宁愿坚持使用 1.9.x 和 jQuery Migrate.

However, with the release of jQuery 2.0 I'm now prompted to upgrade jQuery 1.9.1 to 2.0. At this time I have enough visitors across my sites using 'ancient' versions of browsers that I'd rather stick with 1.9.x and jQuery Migrate.

在检查包的更新(jQuery 或其他)时,是否告诉 Nuget 坚持使用特定版本(1.9.x)?

Is there anyway to tell Nuget to stick with a particular version (1.9.x) when checking for updates of a package (jQuery or otherwise)?

我正在使用 Visual Studio 2010/2012 扩展,但如果我需要在 VS 中使用命令行界面来解决这个问题,我当然会.

I'm using the Visual Studio 2010/2012 extensions, but if I need to use the command line interface within VS to work around this issue, I certainly will.

注意:在我脑海中的一件事是他们搞砸了更新.由于 jQuery 1.9.x 和 2.0.x/2.x 完全不同,看来他们应该创建一个 jQuery 2(.0.x|.x) 包.

Note: One thing in the back of my mind is that they messed up the update. Since jQuery 1.9.x and 2.0.x/2.x are fairly different, it seems they should have created a jQuery 2(.0.x|.x) package instead.

当然,真正想要更新到 2.x 的人必须了解它并切换他们想要安装的软件包.但鉴于它包含重大更改,也许这样会更好?

Of course then people who actually want to update to 2.x will have to know about it and switch which package they want installed. But given that it contains breaking changes, maybe that's better?

推荐答案

在我看来,这是包作者的一个错误.删除对多个浏览器的支持的更新应该被制作成单独的版本 2 nuget 包并相应地进行宣传,即带有重要的免责声明.1.9 库不是遗留的,将来会收到进一步的更新.我已经和包作者联系过,如果收到回复会写更多.

In my opinion, this is a mistake on the package author's part. An update which removes support for several browsers should have been made into a separate version 2 nuget package and advertised accordingly, i.e. with significant disclaimers. The 1.9 library is not legacy and will receive further updates in the future. I've been in touch with the package author and will write more if I receive a reply.

在此期间,您可以通过在 packages.config 中使用以下语法来限制包的版本:

In the interim, you can constrain the version of your package by using the following syntax in your packages.config:

<package id="jQuery" version="1.9.1" allowedVersions="[1.9.1]" />

这里有更多关于版本限制的信息:

There's more information on version constraints here:

http://docs.nuget.org/docs/reference/Versioning

进行配置更改后,更新不应将您的 jQuery 包升级到 2.0 版本.UI 包管理器过去曾出现过不尊重 allowedVersions 属性 (https://nuget.codeplex.com/workitem/1891),因此如果遇到此问题,您可能必须使用命令行.

After making the config change, an update should not upgrade your jQuery package to the 2.0 release. There have been issues in the past with the UI package manager not respecting the allowedVersions attribute (https://nuget.codeplex.com/workitem/1891), so you may have to use the command line if you encounter this problem.

但是,这些都不能解决更新 1.9 分支时发生的问题,因为软件包提要现在将在 2.0+ 的轨道上.我假设您必须切换到专门为支持旧"1.x 版本而编写的新 nuget 包,或者每次手动复制脚本.

However, none of this solves the problem of what happens when the 1.9 branch gets updated because the package feed will now be on the 2.0+ track. I assume you'll have to switch to a new nuget package specifically written to support the 'legacy' 1.x version, or copy the script in manually each time.

无论如何,我会在了解更多信息时更新此内容.

In any case, I'll update this when I learn more.

包作者已声明未来将支持 1.x 2.x 路径,即包源将包含并行版本,而不是拆分它们.据我所知,解决方案是在包配置级别使用版本约束来防止更新到 2.x 版本,例如:

The package author has stated that both the 1.x and 2.x paths will be supported in the future, i.e. the package feed will contain parallel versions instead of them being split. As far as I can see, the solution is to use a version constraint at the package config level to prevent an update to the 2.x version, e.g.:

<package id="jQuery" version="1.9.1" allowedVersions="[1.9.1,2)" />

(在 allowedVersions 中指定最小和最大版本应该允许更新而不会有切换到 2.x 版本的风险.顺便说一句,右括号看起来很奇怪,但它是正确的 - 它意味着 '低于版本 2'.)

(Specifying both min and max versions in allowedVersions should allow updating without risking a switch to the 2.x version. By the way, the right parenthesis looks strange, but is correct - it means 'less than version 2'.)

这篇关于我可以将 Nuget 保留在 jQuery 1.9.x/1.x 路径上(而不是升级到 2.x)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆