我正在尝试将 NuGet 包发布到私有 VSTS 源。我想使用来实现这一点only.NET CLI,无需创建或修改 nuget.config 文件。
我尝试过这样做:
dotnet nuget push <PackageName> --source https://XXX.pkgs.visualstudio.com/_packaging/YYY/nuget/v3/index.json --api-key <VSTS UserName>:<PersonalAccessToken>
I get:
error: Unable to load the service index for source https://XXX.pkgs.visualstudio.com/_packaging/YYY/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).
我可以在 Fiddler 中看到 .NET CLI 仅向其发送 GET 请求https://XXX.pkgs.visualstudio.com/_packaging/YYY/nuget/v3/index.json
没有任何授权令牌。该请求以 401 结束。
NuGet 包凭据和 API 密钥应添加到NuGet.config
file.
所以在使用之前dotnet nuget push
命令,您应该在中添加凭据和 API 密钥NuGet.config
如下两条命令:
nuget sources Add -Name "mysource" -Source "https://XXX.pkgs.visualstudio.com/_packaging/YYY/nuget/v3/index.json" -username name -password PAT
nuget setapikey mykey -source mysource
然后通过以下方式推送NuGet包dotnet nuget push
命令:
dotnet nuget push packagename.nupkg --source mysource --api-key mykey
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)