Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protocolVersion argument to nuget source add #9170

Closed
bvamos opened this issue Feb 12, 2020 · 8 comments · Fixed by NuGet/NuGet.Client#5002
Closed

Add protocolVersion argument to nuget source add #9170

bvamos opened this issue Feb 12, 2020 · 8 comments · Fixed by NuGet/NuGet.Client#5002
Labels
Area:Settings NuGet.Config and related issues Category:Quality Week Issues that should be considered for quality week help wanted Considered good issues for community contributions. Priority:2 Issues for the current backlog. Product:NuGet.exe NuGet.exe Type:Feature
Milestone

Comments

@bvamos
Copy link

bvamos commented Feb 12, 2020

Please read the following information before posting the issue.

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):

NuGet version (x.x.x.xxx): any

Worked before? If so, with which NuGet version: No

Feature request

Ability to specify protocolVersion property when adding new package source with CLI

@nkolev92 nkolev92 added Product:NuGet.exe NuGet.exe Type:Feature Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. labels Jun 11, 2020
@nkolev92 nkolev92 added the Area:Settings NuGet.Config and related issues label Nov 18, 2021
@rtaylor72
Copy link

Is there an ETA on this? Should be very easy to implement.

@GMZwinge
Copy link

GMZwinge commented Jun 29, 2022

Should also support protocolVersion when updating a source, as well as when doing those using dotnet, eg: dotnet nuget add/update source ....

@DavidRadoorHummel
Copy link

This would be very cool to have. Especially in an automated environment where you want to add a source

@nkolev92 nkolev92 added help wanted Considered good issues for community contributions. and removed Triage:NeedsTriageDiscussion labels Sep 26, 2022
@nkolev92
Copy link
Member

We prioritize investigations based on community engagement such as comments and up-votes.
We don't believe we'll get to this issue soon, but we'd be happy to consider a contribution https://github.com/nuget/home#contributing.

@TobiasBreuer
Copy link

Linked #11871 as this issue is really causing trouble in CI pipelines, where NuGet sources are dynamically added via nuget source add.
The fact that we cannot specify the protocolVersion as part of this command - and hence the version is missing from the config, leads to incorrect behavior of the nuget push command later on, not pushing the symbols that exist next to the package...

@zivkan
Copy link
Member

zivkan commented Jan 2, 2023

As a workaround, you can use a small powershell script in your CI:

$xmlDoc = [xml](Get-Content nuget.config)
$newSource = $xmlDoc.CreateElement("add");
$newSource.SetAttribute("key", "MySource");
$newSource.SetAttribute("value", "https://my.source.test/");
$newSource.SetAttribute("protocolVersion", "3");
$packageSources = Select-Xml -Xml $xmlDoc -XPath "/configuration/packageSources"
$packageSources.Node.AppendChild($newSource)
$xmlDoc.Save("nuget.config")

Although using powershell to only set the protocolVersion would be easier:

dotnet nuget add source https://my.source.test/ -n MySource
$xmlDoc = [xml](Get-Content nuget.config)
$MySource = Select-Xml -Xml $xmlDoc -XPath "/configuration/packageSources/add[@key=""MySource""]"
$MySource.Node.SetAttribute("protocolVersion", "3")
$xmlDoc.Save("nuget.config")

If PowerShell isn't already available on your CI, PowerShell (Core) is available as a .NET Tool, so even on Linux and Mac, as long as you have the .NET SDK installed, it should be possible to use one of these. Unfortunately I couldn't find something similar to jq, but for XML.

@TobiasBreuer
Copy link

TobiasBreuer commented Jan 2, 2023

Thx @zivkan. We actually already patch the NuGet.config file along the way as part of our CI, however, I consider this a very hacky workaround and it is definitely not my go-to solution - and it doesn't solve the request to add the argument to the client 😉 - The scenario I linked, is just one example where the argument might come in handy... (while I actually think that it is a bug, that the attribute is required to successfully resolve the symbol stuff)

As soon as I find the time, I plan to provide the required contribution to make this part of an upcoming release...

@nkolev92 nkolev92 added Priority:2 Issues for the current backlog. Category:Quality Week Issues that should be considered for quality week labels Jun 26, 2023
@zivkan
Copy link
Member

zivkan commented Aug 24, 2023

Big thank you to @dotnokato for contributing a PR to implement this feature!

I expect it to ship in NuGet 6.8 and the .NET 8.0.100 SDK.

@zivkan zivkan added this to the 6.8 milestone Aug 24, 2023
@nkolev92 nkolev92 changed the title CLI: add protocolVersion argument to nuget source add Add protocolVersion argument to nuget source add Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Settings NuGet.Config and related issues Category:Quality Week Issues that should be considered for quality week help wanted Considered good issues for community contributions. Priority:2 Issues for the current backlog. Product:NuGet.exe NuGet.exe Type:Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants