Closed heng-liu closed 3 years ago
Closed as fixed.
@heng-liu You should make sure that the issue has correct labels and releases, otherwise it won't show up in the release notes.
Thanks @nkolev92 ! Sorry that I forgot about adding labels after transferring it from Client.Engineering repo..
Could it be that this breaks default behavior of the nuget github action? Starting today I get errors on github actions trying to install a package because the nuget.org default feed is not listed there anymore:
(Notice that I'm not using nuget's restore here, it's a plain nuget install
command line)
@gonzalocasas please see https://github.com/actions/virtual-environments/issues/3038 and https://github.com/NuGet/Home/issues/10586
I was suffering exactly this but I hadn't got the NuGet.org source.
I will leave here the content of the XML so it may help anyone
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
This is still a problem in .NET 6.
@aortiz-msft commented on Fri Feb 12 2021
Inside the interactive container, run
It will list nuget.org as a source: “Registered Sources:
nuget.org [Enabled] https://api.nuget.org/v3/index.json ”
Run
It will say “Package source with Name: nuget.org removed successfully.” Run (again)
Expected behavior: The list should be empty. Nuget.org should no longer be a source to pull packages from. Actual behavior: “Registered Sources:
@heng-liu commented on Fri Feb 12 2021
Tried to repro in following three cases: 1.I could repro when nuget.org is the only feed in user-wide NuGet.Config file.
2.If there is a second feed(e.g. secondFeed /home/henli/packages) there, and I remove the nuget.org feed, the nuget.org will not be added back automatically when running
dotnet nuget list source
.3.If I remove the second feed first, then remove the nuget.org, and run dotnet list source, it will show "No sources found. " and nuget.org will not be added back anymore.
The reason might be: NuGet will create a default user-wide NuGet.Config file( with only nuget.org feed) when the NuGet.Config file doesn't exist, or the setting is empty there. The code is: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Configuration/Settings/Settings.cs#L551-L564 But I haven't figured out why case 3 doesn't add nuget.org back. I still need some investigation.
@heng-liu commented on Fri Feb 12 2021
Tried to patch and debug and found the root cause is in the following code:
So we have only one nuget.org source in NuGet.Config file,
when we run
dotnet nuget remove source nuget.org
, for the first time,When we run
dotnet nuget remove source nuget.org
for the second time, it will found there was no track file in line5, so it will 1.Generate a track file in line7 2.Generate a default NuGet.Config file with only nuget.org feed, and save it to disk in line9-11.When there is a track file generated, it will skip line6-12 to generate a default NuGet.Config file. So from now on,
dotnet nuget list source
, or any other commands would access the NuGet.Config file, will get the right contents(empty, no source) of NuGet.Config file.@heng-liu commented on Fri Feb 12 2021
Found the PR adding track file: https://github.com/NuGet/NuGet.Client/pull/458
I could repro on NuGet.exe 3.4.4.
@zivkan commented on Thu Feb 18 2021
This bug, or at least a summary, would be valuable for customers so should be on NuGet/Home, especially so that when this ships GA there's an issue for customers to read in the release notes. At least, in my opinion.
@heng-liu commented on Thu Feb 18 2021
Thanks @zivkan . I'll move it to home. Do you have any concerns? @aortiz-msft