Home: Can't remove config key using nuget.exe

Created on 13 Jun 2019  路  9Comments  路  Source: NuGet/Home

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!

Settings Quality Week Backlog 2 NuGet.exe

Most helpful comment

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.

All 9 comments

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

Any updates? 5.3.0 is still affected.

Still the same with nuget version 5.3.1.6268...

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.

@kennydv Perfect your workaround work perfectly 馃 馃槃
Thank you !

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!

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

This is still a problem in NuGet Version: 5.7.0.6726

/cc @dominoFire

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotMorten picture dotMorten  路  3Comments

msaraf1 picture msaraf1  路  3Comments

skofman1 picture skofman1  路  3Comments

philippe-lavoie picture philippe-lavoie  路  3Comments

LordMike picture LordMike  路  3Comments