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 append TargetOS to .NETFramework tfms #12288

Merged
merged 1 commit into from
Jan 23, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@
</Target>

<Target Name="GetProjectWithBestTargetFrameworks">
<ItemGroup Condition="'$(BuildTargetFramework)' != ''">
<_BuildTargetFrameworkWithTargetOS Include="$(BuildTargetFramework)-$(TargetOS.ToLowerInvariant())" />
<ItemGroup>
<_BuildTargetFramework Include="$(BuildTargetFramework)"
Condition="'$(BuildTargetFramework)' != ''" />
<_BuildTargetFramework Include="$([MSBuild]::Unescape($([System.Text.RegularExpressions.Regex]::Replace('$(TargetFrameworks)', '(-[^;]+)', ''))))"
Copy link
Member

Choose a reason for hiding this comment

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

this could use a comment 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. I will add one next time when I'm in the codebase.

Condition="'$(BuildTargetFramework)' == ''" />
</ItemGroup>
<ItemGroup Condition="'$(BuildTargetFramework)' == ''">
<_BuildTargetFrameworkWithoutOS Include="$([MSBuild]::Unescape($([System.Text.RegularExpressions.Regex]::Replace('$(TargetFrameworks)', '(-[^;]+)', ''))))" />
<!-- TODO: Find a better way to filter out non applicable TargetOS values for .NET Framework. -->
<_BuildTargetFrameworkWithTargetOS Include="@(_BuildTargetFrameworkWithoutOS->Distinct()->'%(Identity)-$(TargetOS.ToLowerInvariant())')"
Condition="'$(TargetOS)' == 'windows' or !$([System.String]::Copy('%(Identity)').StartsWith('net4'))" />

<ItemGroup>
<_BuildTargetFrameworkWithTargetOS Include="@(_BuildTargetFramework->Distinct()->'%(Identity)-$(TargetOS)')"
Condition="!$([System.String]::Copy('%(Identity)').StartsWith('net4'))" />
<_BuildTargetFrameworkWithTargetOS Include="@(_BuildTargetFramework->Distinct())"
Condition="$([System.String]::Copy('%(Identity)').StartsWith('net4'))" />
</ItemGroup>

<ChooseBestTargetFrameworksTask BuildTargetFrameworks="@(_BuildTargetFrameworkWithTargetOS);$(AdditionalBuildTargetFrameworks)"
SupportedTargetFrameworks="$(TargetFrameworks)"
RuntimeGraph="$(BundledRuntimeIdentifierGraphFile)"
Expand Down