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

Can't remove config key using nuget.exe #8223

Closed
MitchMcHenry1 opened this issue Jun 13, 2019 · 11 comments · Fixed by NuGet/NuGet.Client#4080
Closed

Can't remove config key using nuget.exe #8223

MitchMcHenry1 opened this issue Jun 13, 2019 · 11 comments · Fixed by NuGet/NuGet.Client#4080
Assignees
Labels
Area:Settings NuGet.Config and related issues Category:Quality Week Issues that should be considered for quality week Priority:2 Issues for the current backlog. Product:NuGet.exe NuGet.exe Type:Bug

Comments

@MitchMcHenry1
Copy link

Details about Problem

NuGet product used: NuGet.exe

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

OS version (i.e. win10 v1607 (14393.321)): win10 v1709 (16299.1146)

Worked before? If so, with which NuGet version:
Hasn't worked since at least 4.9.3. Not sure prior to that.

Detailed repro steps so we can see the same problem

NuGet CLI config command documentation states that you can remove a key from the config file by using nuget config -set <name>= with no value after the =. However, this seems to have no affect on the config file.

Example:
nuget config -set dependencyVersion="Highest"
New dependencyVersion key will be added to nuget.config:

<config>
  <add key="dependencyVersion" value="Highest" />
</config>

Now try to remove the key:
nuget config -set dependencyVersion=
nuget.config file is unchanged, dependencyVersion key and value are still present:

<config>
  <add key="dependencyVersion" value="Highest" />
</config>

Other suggested things

Also tried:
nuget config -set dependencyVersion=""
which has no affect.

nuget config -set dependencyVersion=" "
This will replace the value with a space (" "), but the key is still present in the file.

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

No info in the verbose log other than version:

nuget config -set dependencyVersion= -verbosity detailed
NuGet Version: 5.0.2.5988

Sample Project

Very helpful if you can zip a project and paste into this issue!

@donnie-msft donnie-msft added this to the Backlog milestone Jun 13, 2019
@donnie-msft donnie-msft added the Priority:2 Issues for the current backlog. label Jun 13, 2019
@donnie-msft
Copy link
Contributor

Was able to repro in mentioned versions and also NuGet Version: 4.4.3.5892.

@nkolev92 nkolev92 added Area:Settings NuGet.Config and related issues and removed NuGet API labels Jun 14, 2019
@hilari0n
Copy link

Any updates? 5.3.0 is still affected.

@ernest33
Copy link

Still the same with nuget version 5.3.1.6268...

@kennydv
Copy link

kennydv commented Feb 14, 2020

I had the same issue. For now I use the following workaround:
It seems the deletion does work when you add a second 'set' command.
f.e: "nuget.exe config -Set repositoryPath= -set signatureValidationMode=accept"
does delete the repositoryPath-setting, where "nuget.exe config -Set repositoryPath=" would not.
Note: i use "signatureValidationMode=accept" just because this is the default value so it does not really change anything.

@ernest33
Copy link

@kennydv Perfect your workaround work perfectly 🥇 😄
Thank you !

@hilari0n
Copy link

Guys, please up-vote the original post in this thread, so it gains more visibility. Maybe they'll fix it sooner this way.
@kennydv: Thanks for the workaround!

@aortiz-msft aortiz-msft added the Category:Quality Week Issues that should be considered for quality week label Apr 2, 2020
@uzxmx
Copy link

uzxmx commented Jun 20, 2020

Just encountered this issue too. I'm using version 5.5.1.6542. No good way to unset the config. Vote for such feature.

@m8ram
Copy link

m8ram commented Oct 26, 2020

This is still a problem in NuGet Version: 5.7.0.6726

@donnie-msft
Copy link
Contributor

/cc @dominoFire

@gucu112
Copy link

gucu112 commented May 26, 2021

Hi. I've got the same issue with NuGet 5.9.1.11, MS Windows Server 2016 v1607 (OS build 14393.4402).

@donnie-msft
Copy link
Contributor

I took some time today to look into this, and just merged a fix. Basically, the "delete" codepath didn't save to disk!

@kennydv your workaround worked because the 2nd key/value caused the modified config to be written to disk (code). I tested your workaround and my PR didn't break it, but you could drop the workaround after the PR is released.

Thank you all for commenting and upvoting. We'll let you know when it's planned for release.

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 Priority:2 Issues for the current backlog. Product:NuGet.exe NuGet.exe Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.