NuGet/Home

In nuget.config, packageSourceMapping settings trump disabledPackageSources

Open

#14,530 opened on 2025年9月10日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)HTML (1,459 stars) (292 forks)batch import
Area:PackageSourceMappingPriority:3Type:Bughelp wanted

説明

NuGet Product Used

dotnet.exe

Product Version

.NET 9.0.8

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

First time posting a nuget issue, so if I miss providing some relevant/required information, please let me know and I'll update.

If you have a nuget.config file where you include multiple package sources and where you use package source mappings, if you disable a package source that has mappings by adding an entry to the disabledPackageSources section, package restore might fail because it still considers the mappings for that source even if it is disabled.

What I'm trying to do is simple: we have an artifact feed with our release builds of some libraries and sometimes I do a local build of those libraries and want to debug them when they are used in other projects. To handle this I have a "debug" package source that is disabled, and a "release" package source that is not disabled. For the release package source, I have it mapped to "*", and for the debug package source, I map it to the specific packages that I have built in debug and deployed into a local folder so that those will be debuggable when I work with them. The trouble is that this approach, which should work, does not because nuget tries to apply mappings according to all package source mappings, instead of doing the right thing and ignoring any mappings that are in the disabled package source.

The workaround to this is pretty simple: I just get rid of the disabledPackageSources section and instead comment out the actual debug package source, but that's not the right solution because if a package source is disabled then it should not be considered when mapping packages at all.

Verbose Logs

コントリビューターガイド