Fix GivenDotnetPackageAdd test failures with package source mapping for Central Package Management #52440
+21
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #52439.
The
FileBasedApp_CentralPackageManagement_NoVersionSpecified_KeepExistingtest was failing whennoRestore=falsedue to NuGet requiring package source mapping when using Central Package Management with multiple sources. Without it, NuGet issued NU1507 warnings and NU1101 errors for packages not available on all configured sources.Changes
NuGet.configcreation in test setup with package source mappingHumanizer*packages to nuget.orgThis satisfies NuGet's Central Package Management requirements and ensures all packages restore from appropriate sources.
All test combinations now pass, including previously failing scenarios with
noRestore=false.Original prompt
This section details on the original issue you should resolve
<issue_title>
GivenDotnetPackageAddnoRestore=falsefails to work with package source mapping</issue_title><issue_description>A Package Add test is failing when no restore is set to false.
This appears to impact release/10.0.1xx and release/10.0.2xx at the very least.
Microsoft.DotNet.Cli.Package.Add.Tests.GivenDotnetPackageAdd.Microsoft.DotNet.Cli.Package.Add.Tests.GivenDotnetPackageAdd.FileBasedApp_CentralPackageManagement_NoVersionSpecified_KeepExisting(legacyForm: True, fileOption: False, noRestore: False)