Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overbuild source generator when root building for net48 #105347

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/libraries/oob-gen.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<Project Sdk="Microsoft.Build.Traversal">

<PropertyGroup Condition="'$(BuildTargetFramework)' != '' and '$(BuildTargetFramework)' == '$(NetFrameworkCurrent)'">
<TargetFramework>$(BuildTargetFramework)</TargetFramework>
<!-- Filter ProjectReferences to build the best matching target framework only. -->
<FilterTraversalProjectReferences>true</FilterTraversalProjectReferences>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this still overbuild in the case that a generator doesn't multi-target? What was causing the overbuild to happen? I would have expected any duplicates to hit the MSBuild project cache - were global properties different?

Copy link
Member Author

@ViktorHofer ViktorHofer Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different global properties, yes. More precisely, the BuildTargetFramework property set.

This solution works for both multi targeting and non multi-targeting builds and is just following what we already do in the other oob-*.projs. I simpy forgot to add that part.

See https://github.com/dotnet/runtime/blob/main/eng%2FTraversalSdk.AfterTargets.targets

</PropertyGroup>

<!-- Reference all out-of-band generator projects. -->
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)*\gen\**\*.*proj"
Expand Down
Loading