【发布时间】:2013-01-21 20:56:04
【问题描述】:
一些上下文:
我有 4 个具有依赖项的 nuget 包。它们都处于预发布模式,并且按照自己的节奏从 alpha 发展到“稳定”。我希望能够在依赖定义中指定应该包含预发布,但是当“稳定”版本可用时,它应该更新到稳定版本。
在NuGet Docs 中,版本控制规则定义[ 和] 包含您指定的版本号,( 和) 排除您指定的版本号。
关于 nuspec 文件中版本影响的一些示例:
<dependencies>
<dependency id="MyComponent" version="1.2.0" />
</dependencies>
==> 这将安装 MyComponent 1.2.0 或更高版本。 (不包括预发布 1.2.0-alpha)
<dependencies>
<dependency id="MyComponent" version="[1.2.0" />
</dependencies>
==> 这将安装 MyComponent 1.2.0 或更高版本。 (不包括预发布 1.2.0-alpha)
<dependencies>
<dependency id="MyComponent" version="[1.2.0,2)" />
</dependencies>
==> 这将安装 MyComponent 1.2.0 直到但不包括版本 2.0.0。 (不包括 prerelease 1.2.0-alpha 但包括 prerelease 2.0.0-alpha)
目前我设置:
<dependencies>
<dependency id="MyComponent" version="(1.1.32767" />
</dependencies>
但我觉得这是一种非常丑陋的方式,它并不能真正反映现实。 (如果存在版本 1.1.32767.1 怎么办?)
我想知道如何指定您希望在最低版本中包含预发布版本?
【问题讨论】:
-
那么给定版本 1.1.32767,您想要包含哪些版本,哪些不包含?
-
包括 1.2.0-alpha、包括 1.2.0、包括 1.2.1 等。排除应为 1.1.xxx
-
哪里有 1.1.xxx 低版本或 1.1.32767 的预发布版?
-
包 X 需要依赖包 Y 版本 1.2.0-alpha 或更高版本。如果我将 1.2.0 放在依赖项中,则不会安装 alpha。
-
目前安装
1.2.0-alpha的唯一方法是将(1.1.32767放在依赖项中。