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

Disable TargetingPack Analyzers #92648

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 12 additions & 0 deletions eng/targetingpacks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@
</ItemGroup>
</Target>

<!-- Don't use the TargetingPack Analyzers for current .NET version unless explicitly enabled -->
Copy link
Member

@ViktorHofer ViktorHofer Sep 26, 2023

Choose a reason for hiding this comment

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

When I read this, it wasn't obvious to me that the target only applies to projects that don't use the local targeting / runtime pack. You want to point that out in the code comment.

For which projects should this target run? Microsoft.NETCore.Platforms doesn't use the local targeting pack but doesn't disable implicit framework references. Are there other such projects under src/libraries?

<Target Name="RemoveTargetingPackAnalyzers"
Condition="'$(UseLocalTargetingRuntimePack)' != 'true' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(TargetFrameworkVersion)' == 'v$(NetCoreAppCurrentVersion)' and
'$(UseTargetingPackAnalyzers)' != 'true'"
AfterTargets="ResolveTargetingPackAssets">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.FrameworkReferenceName)' != ''" />
</ItemGroup>
</Target>

<!-- Update the local targeting pack's version as it's written into the runtimeconfig.json file to select the right framework. -->
<Target Name="UpdateRuntimeFrameworkVersion"
Condition="'$(UseLocalTargetingRuntimePack)' == 'true'"
Expand Down
Loading