如何配置packages.config下载最高版本 [英] How configure packages.config to download the highest version

查看:35
本文介绍了如何配置packages.config下载最高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置 packages.config 以下载可用的最高版本的包.我该怎么做?

I want to configure packages.config to download the available highest version of a package. How can I do that?

类似于:

<package id="PackageName" version="Highest" ... />

我看到了 attr "allowedVersions",但它总是下载 "version" attr 中配置的版本.

I saw attr "allowedVersions", but it always download the version configured in "version" attr.

推荐答案

如何配置packages.config下载最高版本

How configure packages.config to download the highest version

正如 Ashley 和 Matt 所说,这是不可能的,因为 packages.config 只允许指定一个包的单个版本.

Just as Ashley and Matt said, it is impossible to do that, because packages.config only allows a single version of a package to be specified.

简单的解决方法是使用 nuget cli 在预构建事件中更新该包:

The simple workaround is using nuget cli to update that package in the pre-build event:

$(YourNuGetPath)\nuget.exe update "$(ProjectDir)packages.config" -Id "<YourPackageId>"

通过此构建事件,Visual Studio 会在您构建项目之前将该包更新到最新版本.

With this build event, Visual Studio will update that package to the latest version before you build your project.

这篇关于如何配置packages.config下载最高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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