gpt4 book ai didi

nuget - 使用 Azure Devops 发布 Nuget 包

转载 作者:行者123 更新时间:2023-12-04 19:32:05 24 4
gpt4 key购买 nike

我正在尝试在 Azure DevOps 中创建一个发布管道,它将发布一个包到 Nuget.org。构建管道工作得很好,并将包创建为构建工件。我可以发布到 Azure Artifacts 中托管的提要,但无法发布到 Nuget.org。我相信问题出在服务连接上。 Service Connection .

我试过使用 ApiKey 但这会引发错误

DotNet Core does not support encrypted API Key' error



这是尝试推送包的发布步骤。
enter image description here

我也试过 https://api.nuget.org/v3/index.json对于 Feed URL,但这似乎没有什么区别。

日志输出。

2018-10-21T23:27:36.3177322Z ##[section]Starting: Nuget Push 2018-10-21T23:27:36.3183449Z ============================================================================== 2018-10-21T23:27:36.3183547Z Task : .NET Core 2018-10-21T23:27:36.3183635Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet. 2018-10-21T23:27:36.3183729Z Version : 2.141.0 2018-10-21T23:27:36.3183791Z Author : Microsoft Corporation 2018-10-21T23:27:36.3183871Z Help : More Information 2018-10-21T23:27:36.3183936Z ============================================================================== 2018-10-21T23:27:37.1663123Z [command]C:\Windows\system32\chcp.com 65001 2018-10-21T23:27:37.1762529Z Active code page: 65001 2018-10-21T23:27:37.1808736Z SYSTEMVSSCONNECTION exists true 2018-10-21T23:27:37.3473599Z SYSTEMVSSCONNECTION exists true 2018-10-21T23:27:37.4707171Z SYSTEMVSSCONNECTION exists true 2018-10-21T23:27:37.4739974Z e3e8a3af-5c6c-44e9-820c-c62af0972256 exists true 2018-10-21T23:27:37.4807474Z Saving NuGet.config to a temporary config file. 2018-10-21T23:27:37.4833034Z Saving NuGet.config to a temporary config file. 2018-10-21T23:27:37.4919745Z Using authentication information for the following URI: https://www.nuget.org/api/v2/package 2018-10-21T23:27:37.4988034Z [command]C:\hostedtoolcache\windows\dncs\2.1.105\x64\dotnet.exe nuget push "{package}" --source https://www.nuget.org/api/v2/package --api-key RequiredApiKey 2018-10-21T23:27:38.3984300Z info : Pushing TranslatorConsole.1.0.0.6.nupkg to 'https://www.nuget.org/api/v2/package'... 2018-10-21T23:27:38.4171650Z info : PUT https://www.nuget.org/api/v2/package/ 2018-10-21T23:27:38.8798808Z info : Forbidden https://www.nuget.org/api/v2/package/ 462ms 2018-10-21T23:27:38.9562536Z error: Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.). 2018-10-21T23:27:40.2195255Z ##[error]Error: C:\hostedtoolcache\windows\dncs\2.1.105\x64\dotnet.exe failed with return code: 1 2018-10-21T23:27:40.2206711Z ##[error]Packages failed to publish 2018-10-21T23:27:40.2307763Z ##[section]Finishing: Nuget Push

最佳答案

在 Github 中跟踪了一个问题:DotNetCore currently does not support using an encrypted Api Key

Using an ApiKey is currently not supported in dotnet because the required libraries for encrypting the key are not available, sorry for the inconvenience. You should be able to use a service endpoint configured with a username/password combination. If you can only use an ApiKey, I would suggest using the nuget 2.* task to push.



因此,您可以尝试使用 Nuget 2.*推送包的任务。 (添加任务 --> 包 --> Nuget)

或者,您可以通过调用 dotnet nuget push 尝试通过命令行任务将包推送到 NuGet 服务器。命令来处理这个问题。引用此线程: error while trying to push nuget package from VSTS

关于nuget - 使用 Azure Devops 发布 Nuget 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52920786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com