Skip to content

[BUG]: DotNetCoreCLI dotnet restore with credentials removes protocolVersion #21055

Open
@shessane

Description

@shessane

New issue checklist

Task name

DotNetCoreCLI

Task version

V2

Issue Description

Hi,
There's a problem with dotnet restore task using config and authenticated feed. The generated Nuget.config removes any nuget protocol versions specified.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="Artifactory" value="..." protocolVersion="3" />
  </packageSources>
</configuration>

Will be rewrited without protocolVersion :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="Artifactory" value="..." />
  </packageSources>
</configuration>

This is problematic with feeds that uses the same URL for v2 and v3, and mirrors feeds that supports only v3 (telerik for example).

Workaround :

  1. First use task NugetAuthenticate to authenticate to the feed and generate the Nuget.config keeping the protocol version.
  2. Use dotnet restore without credentials

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows and Ubuntu

Relevant log output

N/A

Full task logs with system.debug enabled

N/A

Repro steps

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions