Reputation: 2964
I need to restore packages that are produced by other pipelines
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
restoreSolution: 'build.sln'
#feedsToUse: 'select'
#vstsFeed: 'Some-DLLs'
# includeNuGetOrg: true
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
Where nuget.config
is
<?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>
However, he step fails
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]
This also doesn't work
- task: CmdLine@2
inputs:
script: 'dotnet restore --configfile nuget.config proj\proj.csproj'
Upvotes: 0
Views: 1965
Reputation: 13534
Please check with the following things:
If the Artifacts feed and the pipeline are in the same project, you can use the restore task to directly restore the packages from the feed to the pipeline.
If the Artifacts feed and the pipeline are in different projects but in the same organization/collection.
Feed settings
" > "Views
" > Select "Local
" > Click "Edit
" > Select "All feeds and people in <Your_Collection_Name>
". With this way, all the pipelines in the same organization/collection are able to use the download the packages from the feed.If the feed is outside the current organization/collection, you need to create a NuGet service connection to access the feed.
Upvotes: 1