我了解如何使用 nuget 命令行发布 nuget 包
但是我四处搜索我没有找到有关如何发布 nuget 预发布包的文档
您只需指定使用 SemVer 格式(例如 1.0-beta)而不是通常格式(例如 1.0)的版本字符串,NuGet 会自动将其视为预发布包。
“从 NuGet 1.6 开始,NuGet 支持通过根据语义版本控制 (SemVer) 规范在版本号中指定预发布字符串来创建预发布包。” 请参阅 NuGetDocs - 预发布版本
此外,如果其版本号低于稳定版本,则不会显示预发布版本。例如,如果您有
只有稳定版本会出现在列表中。
如果你有
预发布版本将是可安装的。
只需简单地将“-alpha”或“-beta”添加到文件的version
键中.nuspec
。这会将您的客户端发布为预发布版本。
重要提示:假设你想测试一个版本7.6.6.4
,那么你可以在7.6.6.4-alpha
. 避免添加-alpha
到您已经发布的版本中,例如:7.6.6.3-alpha
样本:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>AnalyticalService.Client</id>
<version>7.6.6.4-alpha</version>
<title>.net client for Analytical Service</title>
<authors>Kushal Seth</authors>
<owners>Kushal Seth</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Alpha version for events integration</description>
<summary>Alpha version for events integration</summary>
<dependencies>
<dependency id="EntityFramework" version="6.1.3" />
<dependency id="Newtonsoft.Json" version="11.0.2" />
<dependency id="System.Net.Http" version="4.0.0" />
<dependency id="System.Net.Http.Formatting.Extension" version="5.2.3" />
<dependency id="WindowsAzure.Storage" version="9.3.3" />
<dependency id="Polly" version="7.1.0" />
<dependency id="Microsoft.Azure.KeyVault.Core" version="1.0.0" />
<dependency id="NETStandard.Library" version="1.6.1" />
<dependency id="Microsoft.NETCore.Platforms" version="1.1.0" />
</dependencies>
</metadata>
<files>
<file src="E:\service\AnalyticalService\src\AnalyticalService.Client\bin\Release\AnalyticalService.Client.dll" target="lib\AnalyticalService.Client.dll" />
<file src="E:\service\AnalyticalService\src\AnalyticalService.Client\bin\Release\AnalyticalService.Model.dll" target="lib\AnalyticalService.Model.dll" />
</files>
</package>
要在 Nuget 包管理器中检查您发布的包,您必须选中此复选框:(我使用的是 VS 2019 Professional 16.8 版本,您的 VS 版本中可能有类似的选项)