将某些包的 nuget 包更新限制为当前版本 [英] Restrict nuget package updates to current versions for some packages

查看:26
本文介绍了将某些包的 nuget 包更新限制为当前版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法禁用项目中安装的特定 nuget 包的更新?

Is there a way to disable updates of specific nuget packages installed in a project?

我已经对几个 javascript 库包进行了一些本地修改,并且不想冒着将来有人更新我的更改的风险.

I have made some local modifications to a couple of javascript library packages and do not want to run the risk of someone updating over the top of my changes in the future.

我从未创建过自己的 nuget 包,我猜一种选择可能是分叉现有的包?

I've never created my own nuget package, I'm guessing one option might be to fork the existing packages?

推荐答案

你可以试试 约束包,因此您的项目将只允许使用特定版本.然后将阻止对任何较新版本的所有更新.

You could try constraining the package so it your project will only allow a particular version to be used. Then all updates to any newer version will be prevented.

您可以通过编辑项目的 package.config 文件来做到这一点.例如,下面的行应该只允许使用 2.1.0 版本.

You can do this by editing your project's package.config file. For example, the line below should only allow version 2.1.0 to be used.

<package id="SomePackage" version="2.1.0" allowedVersions="[2.1.0]" />

这篇关于将某些包的 nuget 包更新限制为当前版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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