'dotnet nuget push ...' 似乎没有推符号

'dotnet nuget push ...' doesn't seem to be pushing the symbols

dotnet clean --configuration Debug
dotnet build --configuration Debug --version-suffix beta.12
dotnet pack --include-symbols --include-source --configuration Debug --version-suffix beta.12

到目前为止一切顺利 - 以上三个命令生成了两个不错的包:xyz.2.1.2-beta.12.nupkg 和 xyz.2.1.2-beta.12.symbols.nupkg。但是当我 运行 最后一个命令时:

dotnet nuget push bin\Debug\ --source https://www.nuget.org

因这些消息而失败:

info : Pushing xyz.2.1.2-beta.12.nupkg to the NuGet gallery (https://www.nuget.org)...

info : PUT https://www.nuget.org/api/v2/package/

warn : This package will only be available to download with SemVer 2.0.0 compatible NuGet clients,such as Visual Studio 2017 (version 15.3) and above or NuGet client 4.3 and above. For more information,see https://go.microsoft.com/fwlink/?linkid=852248.

info : Created https://www.nuget.org/api/v2/package/ 1573ms

info : Your package was pushed.

info : Pushing xyz.2.1.2-beta.12.symbols.nupkg to the NuGet gallery (https://www.nuget.org)...

info : PUT https://www.nuget.org/api/v2/package/

info : Conflict https://www.nuget.org/api/v2/package/ 1006ms error: Response status code does not indicate success: 409 (A package with ID 'xyz' and version '2.1.2-beta.12' already exists and cannot be modified.).

所以,很明显,符号包推送失败了。 dotnet nuget push...nuget push... 都会发生这种情况 好像是什么问题?

我刚遇到这个问题,几分钟前就解决了。

Symbols 包有一种新格式,它是 .snupkg 扩展名。

如果您使用的是 dotnet clinuget cli,您可以执行以下操作:

包装:

DOTNET CLI

dotnet pack MyAwesomeLib.csproj --include-symbols -p:SymbolPackageFormat=snupkg -c release

NUGET CLI

nuget pack MyAwesomeLib.nuspec -Symbols -SymbolPackageFormat snupkg

发布:

DOTNET CLI

 dotnet nuget push MyAwesomeLib.1.0.0.nupkg -s https://api.nuget.org/v3/index.json -k ~~your API key here~~

NUGET CLI

nuget push MyAwesomeLib.1.0.1.nupkg -Source https://api.nuget.org/v3/index.json -apikey ~~your API key here~~

您可以从 here 阅读更多相关信息。