dotnetcli publish does not use vstsfeed parameter when restoring nuget packages
Steps to reproduce
- task: DotNetCoreCLI@2
displayName: Dotnet Build
inputs:
publishWebProjects: false
command: "publish"
vstsFeed: '7b591551-0978-4734-ac2a-1172b12c2a17'
arguments: "$(solutionName) --configuration $(buildConfiguration) --output c:\artifact
Expected behavior
usage of the vstsFeed parameter
Actual behavior
C:\Program Files\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : Unable to load the service index for source https://mycustomrepo.pkgs.visualstudio.com/_packaging/COLD/nuget/v3/index.json. [d:\a\1\s\NextPipeLab.NetworkService\NextPipeLab.NetworkService.csproj] C:\Program Files\dotnet\sdk\2.2.105\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized).
Workaround
Execute the same DotNetCoreCli@2 task but then do the Dotnet Restore command first before executing the dotnet publish command. But this results in 2 tasks instead of one. The nuget restore being executed by 'Dotnet publish' does restore packages that are from public feeds. However when providing a vstsfeed it does not seem be respected.
Environment data
dotnet --info output:
run as a azure devops dotnetcli@2 task:
Starting: my custom dotnetcli task
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.156.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
\windows\system32\chcp.com 65001 Active code page: 65001 :\Program Files\dotnet\dotnet.exe" --info .NET Core SDK (reflecting any global.json): Version: 2.2.105 Commit: 7cecb35b92
Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.105\
Host (useful for support): Version: 2.2.3 Commit: 6b8ad509b6
Remarks
Seems to be in the same area as https://github.com/microsoft/azure-pipelines-tasks/issues/10507
This task in Azdo is not really owned by us. I would recommend following up on the issue you have linked here already for azure pipelines.
cc @wli3 who might know someone we can ping about this.
This issue was moved to microsoft/azure-pipelines-tasks#11315