azure 遇到错误:响应状态代码未指示成功:500(内部服务器错误)在dotnet cli nuget推送上

icomxhvb  于 2023-01-02  发布在  其他
关注(0)|答案(1)|浏览(799)

从dotnet 5迁移到dotnet 6后,生成管道在Dotnet nuget push上失败,错误如下。我们使用的是Azure Devops Server 2020.1。这是否支持最新的dotnet 6或我是否需要升级到最新版本。

##[section]Starting: dotnet nuget push
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.174.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
[command]C:\windows\system32\chcp.com 65001
Active code page: 65001
SYSTEMVSSCONNECTION exists true
##[warning]Could not create provenance session: %s
##[warning]Failed to read storage account information : Failed to retrieve settings required for storage account information from strongbox. Both StorageAccountKeyBaseName and StorageAccountCount are needed.
[command]"C:\Program Files\dotnet\dotnet.exe" nuget push c:\agents\w1\68\a\abc.efg.MaxData.Models.3.7.0.nupkg --source https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v3/index.json --api-key VSTS
Pushing abc.xyz.Models.2.5.0.nupkg to 'https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/'...
  PUT https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/
  InternalServerError https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/ 43ms
  PUT https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/
  InternalServerError https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/ 33ms
  PUT https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/
  InternalServerError https://tfs.abc.com/tfs/Primary/_packaging/21870199-3f81-4121-b786-82b7e2d3d1dc/nuget/v2/ 43ms
error: Response status code does not indicate success: 500 (Internal Server Error).

Usage: dotnet nuget push [arguments] [options]

Arguments:
  [root]  Specify the path to the package and your API key to push the package to the server.

Options:
  -h|--help                      Show help information
  --force-english-output         Forces the application to run using an invariant, English-based culture.
  -s|--source <source>           Package source (URL, UNC/folder path or package source name) to use. Defaults to DefaultPushSource if specified in NuGet.Config.
  -ss|--symbol-source <source>   Symbol server URL to use.
  -t|--timeout <timeout>         Timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).
  -k|--api-key <apiKey>          The API key for the server.
  -sk|--symbol-api-key <apiKey>  The API key for the symbol server.
  -d|--disable-buffering         Disable buffering when pushing to an HTTP(S) server to decrease memory usage.
  -n|--no-symbols                If a symbols package exists, it will not be pushed to a symbols server.
  --no-service-endpoint          Does not append "api/v2/package" to the source URL.
  --interactive                  Allow the command to block and require manual action for operations like authentication.
  --skip-duplicate               If a package and version already exists, skip it and continue with the next package in the push, if any.

##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Packages failed to publish
Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions. 
Some commonly encountered changes are: 
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[section]Finishing: dotnet nuget push

以下是生成代理计算机上位于%Appdata%/Roaming\NuGet\nuget.config的nuget配置文件
我也使用了PAT凭据,但没有使用,得到同样的错误。请有人帮助我这个。它已经很长一段时间,我困在这里。

6yjfywim

6yjfywim1#

Response status code does not indicate success是发布到NuGet提要时的典型连接问题。
此警告表示您的配置根本未加载:
无法读取存储帐户信息:
无法从strongbox检索存储帐户信息所需的设置。
StorageAccountKeyBaseNameStorageAccountCount都需要。
对于CLI构建任务,请确保已在正确的默认路径中定义了配置,并使用了正确的StorageAccountKeyBaseNameStorageAccountCount

    • 一个
  • 配置文件

要应用的NuGet配置文件。如果未指定,则使用%AppData%\NuGet\NuGet.Config(Windows)、~/.nuget/NuGet/NuGet.Config~/.config/NuGet/NuGet.Config(Mac/Linux)。
还可以修改生成后操作,以提供指向配置文件的特定链接,而不是依赖默认路径。

更新:Azure管道NuGet推送任务

如果要发布到外部源,则需要创建 * NuGet服务连接 * 来管理凭据。以下是有关步骤的更详细的演练:How to publish NuGet Packages to MyGet from Azure DevOps Pipelines
如果您的提要支持(〉= v3),您也可以考虑使用API密钥

相关问题