[英]Unable to load the service index for source
我在 .net 核心 3.1 解决方案的内部部署 Devops 2019 构建服务器上遇到未经授权的错误。 尽管这适用于其他解决方案,但构建服务器似乎无法访问工件提要。 这是错误:
Active code page: 65001
[command]"C:\Program Files\dotnet\dotnet.exe" test C:\a\_work\61\s\MySolution\MySolution.csproj --logger trx --results-directory C:\a\_work\_temp
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error : Unable to load the service index for source https://mydomin/tfs/DefaultCollection/_packaging/MyFeed/nuget/v3/index.json. [C:\a\_work\61\MySolution\MySolution.csproj]
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\a\_work\61\s\MySolution\MySolution.csproj]
这里是 pipeline.yaml 文件,错误发生在 DotNetCoreCLI@2 步骤:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool: 'Default'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.x'
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(buildConfiguration) --self-contained true -f netcoreapp3.1 -r win10-x64 --output $(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
任何建议如何解决身份验证问题?
我尝试在构建服务器上更新工件提要的 PAT 令牌,但没有成功。 这是完整的错误消息:
##[section]Starting: DotNetCoreCLI
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.153.3
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
[command]"C:\Program Files\dotnet\dotnet.exe" publish C:\a\_work\588\s\MySolution.sln --configuration Release --self-contained true -f netcoreapp3.1 -r win10-x64 --output C:\a\_work\588\a\s
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 292,84 ms for C:\a\_work\588\s\MySolution\MySolution.csproj.
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Unable to load the service index for source https://MyDomain/tfs/DefaultCollection/_packaging/MyFeed/nuget/v3/index.json. [C:\a\_work\588\s\MySolution.sln]
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\a\_work\588\s\MySolution.sln]
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : C:\a\_work\588\s\MySolution.sln
##[section]Finishing: DotNetCoreCLI
请尝试在 DevOps 中创建 PAT ,并通过以下命令使用个人访问令牌注册 package 提要:
nuget sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.