Share SDK resolution during Pack and Publish discovery - #55426
Merged
OvesN merged 7 commits intoJul 29, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
…d-evaluation-context-pack-publish
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 27, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves dotnet pack/dotnet publish “Release property” discovery performance by sharing MSBuild SDK resolution and related evaluation caches across the short-lived, properties-only project evaluations performed during discovery (especially for solutions).
Changes:
- Reuse a single
EvaluationContext(SharingPolicyShared) across allProjectInstanceevaluations in a singleReleasePropertyProjectLocatordiscovery operation. - Extend solution conflict tests to exercise both
.slnand migrated.slnxinputs. - Add new unit tests validating that shared evaluation context behavior remains correct (no cross-call retention; path-specific imports and conditional missing imports remain project-specific).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Cli/dotnet/ReleasePropertyProjectLocator.cs | Create and thread a shared EvaluationContext through all properties-only ProjectInstance evaluations during Pack/Publish Release property discovery. |
| test/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs | Extend the conflicting PackRelease/PublishRelease solution test to run against both .sln and .slnx (via dotnet sln migrate). |
| test/dotnet.Tests/CommandTests/Pack/ReleasePropertyProjectLocatorTests.cs | Add focused unit tests to ensure shared-context caching doesn’t leak across discovery calls and remains project-path specific for imports/Exists conditions. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ViktorHofer
reviewed
Jul 29, 2026
ViktorHofer
approved these changes
Jul 29, 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.
Summary
ReleasePropertyProjectLocatoralready uses properties-only partial evaluation to discoverPackReleaseandPublishRelease. This change keepsProjectEvaluationStage.Propertiesand reuses one short-livedEvaluationContextacross all physical-project evaluations performed by a single discovery operation.The selected policy is
Shared. It provides the best measured process-start-to-first-MSBuild-submission duration for both Pack and Publish and shares SDK resolution, filesystem observations, and wildcard/import expansion state across the physical-project discovery evaluations.The context is scoped to one short-lived release-property discovery operation, and the existing parallel solution evaluation remains fully parallel without an external lock.
Performance
Related changes measured together:
The measurement uses
dotnet.cli.process_start_to_msbuild_submission.duration, recorded immediately before the first Pack/Publish MSBuild invocation.OrchardCore.slnxdotnet pack OrchardCore.slnx --no-builddotnet publish OrchardCore.slnx --no-builddotnet-clihistogram measurement per invocationThis metric covers CLI process startup, argument parsing, physical project/solution discovery, and the hidden
ReleasePropertyProjectLocatorevaluations. It excludes the subsequent MSBuild build execution.The same SDK binaries selected three local-only variants:
FullIsolatedPropertiesIsolatedPropertiesSharedPack results
For Pack, partial evaluation reduced the median by 912.37 ms (24.01%). Sharing the context then reduced the partial-evaluation median by another 1,523.38 ms (52.76%). Together they reduced pre-submission time by 2,435.75 ms (64.11%).
Publish results
For Publish, partial evaluation reduced the median by 985.35 ms (24.72%). Sharing the context then reduced the partial-evaluation median by another 1,566.24 ms (52.19%). Together they reduced pre-submission time by 2,551.59 ms (64.01%).
One Properties + Isolated Publish sample was an outlier at 5,448.23 ms, so medians are the primary summary. Properties + Shared still improved all 12 paired rounds relative to Full + Isolated.
End-to-end wall-clock results
Total command time was measured separately with successful
--no-build --no-restoreoperations:OrchardCore.slnxLater MSBuild work is unaffected by these evaluation optimizations and dominates total time. Machine throughput also changed substantially between Publish runs, so paired comparisons within each run/round are the primary wall-clock result.
Paired median decomposition:
Correctness
.sln,.slnx, lazy-solution, and physical-project evaluation paths.SharedSDKCache, andSharedprototypes.ProjectGraphalready uses one fullSharedevaluation context across parallel project evaluations.Virtual/file-based projects
Virtual/file-based project discovery remains unchanged and out of scope. It performs full evaluation because it reads items such as
Compile, and sharing its context would require threading the context through all virtual and referenced-virtual-project evaluations with dedicated behavior coverage.Tests
Remaining risk
Full
Sharedcaches file/directory existence, timestamps, and wildcard/import expansions. If evaluation-time behavior mutates those inputs while discovery is in progress, later evaluations using the same context can observe the cached pre-mutation state. The context is therefore intentionally created per discovery call and discarded before restore or the subsequent MSBuild invocation.