bde*_*ere 4 azure-devops azure-pipelines
使用私有NuGet提要进行身份验证时,启用自包含发布会导致错误。没有“ --self-contained true”,一切运行正常,出现以下错误。我该怎么解决?
##[section]Starting: Publish
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.154.6
Author : Microsoft Corporation
Help : [Learn more about this task](https://go.microsoft.com/fwlink/?linkid=832194) or [see the .NET Core documentation](https://docs.microsoft.com/dotnet/core/)
==============================================================================
[command]C:\Windows\system32\chcp.com 65001
Active code page: 65001
[command]C:\agent\_work\_tool\dotnet\dotnet.exe publish C:\agent\_work\195\s\redacted.csproj --self-contained true --runtime win-x64 --configuration release --output C:\agent\_work\195\a\redacted
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for C:\agent\_work\195\s\redacted.csproj...
Restore completed in 40.71 ms for C:\agent\_work\195\s\redacted.csproj.
Restore completed in 0.51 ms for C:\agent\_work\195\s\redacted.csproj.
Restore completed in 1.17 ms for C:\agent\_work\195\s\redacted.csproj.
Restoring packages for C:\agent\_work\195\s\redacted.csproj...
C:\agent\_work\_tool\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/redacted/_packaging/redacted/nuget/v3/index.json. [C:\agent\_work\195\s\redacted.csproj]
C:\agent\_work\_tool\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\agent\_work\195\s\redacted.csproj]
##[error]Error: The process 'C:\agent\_work\_tool\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : C:\agent\_work\195\s\redacted.csproj
##[section]Finishing: Publish
Run Code Online (Sandbox Code Playgroud)
错误:响应状态代码不指示成功:401(未授权)。
此错误是由Azure Devops中的错误引起的,为了向VSTS提要进行身份验证,Dotnet.exe仅支持dotnet restore和dotnet nuget push命令。因此,请先尝试运行dotnet restore任务。
更新:
由于您已经执行了dotnet restorebefore运行dotnet publish。身份验证问题应由dotnet publish任务引起。在执行时--self-contained true,这意味着除了本地拥有的默认文件之外,它还会尝试从其他路径(包括您的私人供稿)中获取文件。要访问私人供稿,它需要凭据。如果没有凭据,则私有供稿将拒绝获取请求。然后,可能会导致此错误。
而且,dotnet publish包含一个隐式 restore步骤,但没有适当的系统凭据。因此,即使您在较早的步骤中成功运行了dotnet restore,由于未经过身份验证也可能导致dotnet restore失败,因为在上一个任务完成后将清除凭据。
您可以添加--no-restore参数以避免隐式还原。有关更多详细信息,请检查此文档:在publish期间运行的隐式还原。
| 归档时间: |
|
| 查看次数: |
327 次 |
| 最近记录: |