Don't strip default items from build-related Targets when building runnable apps#50942
Merged
baronfel merged 1 commit intodotnet:release/10.0.1xxfrom Sep 22, 2025
Conversation
…ps and/or compute their run arguments we include default items This is load-bearing for some project types, so we instead just make sure that restore-only pathways keep the old default-item exclude
jjonescz
approved these changes
Sep 20, 2025
| public static Dictionary<string, string> GetGlobalPropertiesFromArgs(MSBuildArgs msbuildArgs) | ||
| { | ||
| var globalProperties = msbuildArgs.GlobalProperties?.ToDictionary() ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); | ||
| globalProperties[Constants.EnableDefaultItems] = "false"; // Disable default item globbing to improve performance |
Member
There was a problem hiding this comment.
Consider adding some tests that would reproduce the issue which this is fixing.
Member
There was a problem hiding this comment.
I will probably add a test upstream in dotnet/android, I don't know how you'd reproduce the problem without the Android workload:
Member
There was a problem hiding this comment.
I think it should be fairly easy to repro in dotnet/sdk by adding <CallTarget Targets="Build" /> or something similar in a custom target that runs before/after ComputeRunArguments.
jonathanpeppers
approved these changes
Sep 22, 2025
Member
Author
|
I want to get this in for RC2 and hopefully not wrestle with CI failures more than necessary, so I'll log a follow-up issue to create a test case to pin the behavior. |
dsplaisted
approved these changes
Sep 22, 2025
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.
Potential fix for dotnet/android#10500.
Historically we've included
EnableDefaultItems=falsein purely-evaluation or Restore scenarios as a free performance bump, since doing MSBuild glob expansion is a performance hit that isn't generally necessary in those cases.However, we were including this flag even when running run-related Targets that in android's case involve actual building, so this assumption no longer holds. Due to this, we remove the optimization.