Repository navigation
Re-implement Pack: reuse existing evaluations instead of forcing BuildProjectReferences=false - #7603
Merged
nkolev92 merged 3 commits intoJul 31, 2026
Conversation
Restore Pack evaluation reuse while isolating _GetProjectVersion outputs from consumer-owned items. Preserve no-build behavior and update the include-source assertion for reused evaluations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7f8abcb6-2d81-4392-b9e9-d5e61d4650c4
Keep the upstream port scoped to the Pack targets. The existing project-reference version tests cover the production change without modifying test sources. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7f8abcb6-2d81-4392-b9e9-d5e61d4650c4
Evaluation reuse can retain additional source items, so assert that the user-authored sources are present without requiring an exact item count. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7f8abcb6-2d81-4392-b9e9-d5e61d4650c4
Member
|
This probably needs the old title in the end. |
baronfel
marked this pull request as ready for review
July 30, 2026 20:18
nkolev92
approved these changes
Jul 30, 2026
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
Fixes: NuGet/Home#11530
Description
Restores the Pack evaluation reuse introduced by NuGet.Client #7541 and temporarily reverted by NuGet.Client #7593, while fixing the item collision exposed by that reuse.
VMR build 1524269 and dotnet/dotnet #7907 failed while packing ASP.NET Core because NuGet Pack and ASP.NET Core both used the private item name
_ProjectPathWithVersion. Once #7541 allowed existing project instances to be reused, consumer-created items remained on those instances._GetProjectVersionthen returned the accumulated entries, andPackTaskfailed when it created a dictionary keyed by project path.This change renames NuGet's private
_GetProjectVersionoutput to_ProjectReferenceWithVersion, isolating it from consumer-owned_ProjectPathWithVersionitems and making project-instance reuse safe. Normal Pack calls reuse already-built project evaluations, whileNoBuild=truestill appendsBuildProjectReferences=falsefor_GetFrameworkAssemblyReferencesso referenced projects are not built during a no-build pack.Following Nikolche's feedback on dotnet/dotnet #7952, this port does not add the synthetic collision test because the private-item rename makes that setup obsolete. It does retain the meaningful assertion adjustment in the existing include-source test: evaluation reuse may preserve additional source items, so the test verifies that every user-authored source is present without requiring the package to contain exactly four source entries.
Validation:
dotnet test test\NuGet.Core.FuncTests\Dotnet.Integration.Test\Dotnet.Integration.Test.csproj --no-restore --filter "FullyQualifiedName~PackCommand_IncludeSource_AddsSourceFiles|FullyQualifiedName~PackCommand_PackProject_ExactVersionOverrideProjectRefVersionInMsbuild" /bl:9.binlog— 6 passed, 0 failed.dotnet format whitespace NuGet.sln --verify-no-changes --include test\NuGet.Core.FuncTests\Dotnet.Integration.Test\PackCommandTests.cs --verbosity diagnostic --binarylog 10.binlog— completed successfully.PR Checklist