我需要恢复其他管道产生的包
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
restoreSolution: 'build.sln'
#feedsToUse: 'select'
#vstsFeed: 'Some-DLLs'
# includeNuGetOrg: true
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
nuget.config
在哪里
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="Some-DLLs" value="https://tfs.co.net/tfs/collection/_packaging/Some-DLLs/nuget/v3/index.json" />
</packageSources>
<packageSourceCredetials>
<Some-DLLs>
<add key="Username" value="DOMAIN\richard.barraclough" />
<add key="ClearTextPassword" value="un33xgbppqqbeowgwq6b2xn35gkohzbhrz54ohitxefhc5hgjsla" /> <!-- A PAT -->
</Some-DLLs>
</packageSourceCredetials>
</configuration>
然而,他的步骤失败了
C:\Program Files\dotnet\sdk\5.0.104\NuGet.targets(131,5): error : Unable to load the service index for source https://tfs.co.net/tfs/collection/_packaging/Some-DLLs/nuget/v3/index.json. [C:\agent\_work\19\s\build.sln]
C:\Program Files\dotnet\sdk\5.0.104\NuGet.targets(131,5): error : No credentials are available in the security package [C:\agent\_work\19\s\build.sln]
这也不起作用
- task: CmdLine@2
inputs:
script: 'dotnet restore --configfile nuget.config proj\proj.csproj'
答案 0 :(得分:1)
请检查以下事项:
如果 Artifacts 提要和管道在同一个项目中,您可以使用恢复任务直接将包从提要恢复到管道。
如果 Artifacts 提要和管道在不同的项目中,但在同一个组织/集合中。
Feed settings
”>“Views
”>选择“Local
” > 点击“Edit
” > 选择“All feeds and people in <Your_Collection_Name>
”。通过这种方式,同一组织/集合中的所有管道都能够使用从提要下载的包。如果提要在当前组织/集合之外,您需要创建一个 NuGet service connection 来访问提要。