[Feature]: Verifying the package source mapping configuration #11959
Labels
Area:PackageSourceMapping
Issues related to the package source mapping feature
Priority:2
Issues for the current backlog.
Type:Feature
NuGet Product(s) Involved
NuGet.exe, dotnet.exe
The Elevator Pitch
With the new package source mapping it is possible to restrict certain packages to be restored from specific package sources. But there are scenarios with package source mapping where a local restore succeeds but fails on another machine. This happens when the packages are already cached locally and so the package source mapping is not considered when restoring. This is quite annoying when verifying the package source mapping as the Nuget package cache must be cleared to test a new configuration.
I propose adding an option that will check that all the required packages can be resolved from the package sources using the current package source mapping (skipping the local cache of course). The exact details are up for discussion.
Looking forward for you input on the matter :)
Additional Context and Details
Here is a step-by-step example of how to replicate the problem. Only after clearing the cache does it become clear that the package source mapping does not work.
dotnet new classlib -n test -o .
dotnet add test.csproj package NUnit
: Install any package which is automatically restored and cachedNuget.config
which filters out the installed package using<packageSourceMapping>
(see example below)dotnet restore
: Does not fail because the package is cached%USERPROFILE%\.nuget\packages\NUnit
: Remove the package from the cachedotnet restore
: Restore fails because the package source mapping must be usedHere is an example
Nuget.config
with a restrictive filter:The text was updated successfully, but these errors were encountered: