Skip to content

Commit

Permalink
fix: Adjust tf reordering for VS 17.12 or later
Browse files Browse the repository at this point in the history
Disables TFM order rewriting for 17.12 where WinAppSDK and desktop support has been updated for supporting any position in the TFMs list.

(cherry picked from commit d7f3733)
  • Loading branch information
jeromelaban authored and mergify[bot] committed Oct 19, 2024
1 parent 68cfde9 commit 5e6c681
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions src/Uno.Sdk/targets/Uno.Sdk.After.targets
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,23 @@
<When Condition="
'$(BuildingInsideVisualStudio)' == 'true'
AND '$(UnoDisableFirstTargetFrameworkRewrite)' != 'true'
AND (
$([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'browserwasm'
OR $([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'desktop'
OR $([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'windows'
AND
(
(
$([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))
AND (
$([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'browserwasm'
OR $([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'desktop'
OR $([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'windows'
)
)
OR
(
$([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), 17.12.0))
AND (
$([MSBuild]::GetTargetPlatformIdentifier($(_UnoSelectedTargetFramework))) == 'browserwasm'
)
)
)
AND '$(TargetFrameworks)' != ''
AND '$(_UnoFirstOriginalTargetFramework)' != '$(_UnoSelectedTargetFramework)'
Expand Down Expand Up @@ -76,22 +89,24 @@
</Choose>

<Target Name="_UnoVSWarnBrowserIsFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems;ResolveFrameworkReferences"
Condition="
'$(UnoDisableVSWarnBrowserIsFirst)' != 'true'
AND '$(BuildingInsideVisualStudio)' == 'true'
AND '$(_UnoTargetFrameworkCount)' != ''
AND $(_UnoTargetFrameworkCount) &gt; 1
AND $(TargetFrameworks.Contains('-browserwasm'))
AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) == 'browserwasm'">

<Warning Code="UNOB0010"
Text="The browserwasm TargetFramework must not be placed first in the TargetFrameworks property in order for HotReload to work properly. (See https://aka.platform.uno/UNOB0010)" />
</Target>

<Target Name="_UnoVSWarnDesktopIsFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems;ResolveFrameworkReferences"
Condition="
'$(UnoDisableVSWarnDesktopIsFirst)' != 'true'
AND $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))
AND '$(BuildingInsideVisualStudio)' == 'true'
AND '$(_UnoTargetFrameworkCount)' != ''
AND $(_UnoTargetFrameworkCount) &gt; 1
Expand All @@ -101,21 +116,37 @@
Text="The desktop TargetFramework must not be placed first in the TargetFrameworks property in order for other platforms debugging to work. (See https://aka.platform.uno/UNOB0011)" />
</Target>

<Target Name="_UnoVSWarnDesktopIsNotFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems;ResolveFrameworkReferences"
Condition="
'$(UnoDisableVSWarnDesktopIsNotFirst)' != 'true'
AND $([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), 17.12.0))
AND '$(BuildingInsideVisualStudio)' == 'true'
AND '$(_UnoTargetFrameworkCount)' != ''
AND $(_UnoTargetFrameworkCount) &gt; 1
AND $(TargetFrameworks.Contains('-desktop'))
AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) != 'desktop'">

<Warning Code="UNOB0014"
Text="The desktop TargetFramework must be placed first in the TargetFrameworks property in order for WSL debugging to work. (See https://aka.platform.uno/UNOB0014)" />
</Target>

<Target Name="_UnoVSWarnWindowsIsFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems;ResolveFrameworkReferences"
Condition="
'$(UnoDisableVSWarnWindowsIsFirst)' != 'true'
AND '$(BuildingInsideVisualStudio)' == 'true'
AND '$(_UnoTargetFrameworkCount)' != ''
AND $(_UnoTargetFrameworkCount) &gt; 1
AND $(TargetFrameworks.Contains('-windows'))
AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) == 'windows'">

<Warning Code="UNOB0012"
Text="The windows TargetFramework must not be placed first in the TargetFrameworks property in order for other platforms debugging to work. (See https://aka.platform.uno/UNOB0012)" />
</Target>

<Target Name="_UnoVSWarnNetIsFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems;ResolveFrameworkReferences"
Condition="
'$(UnoDisableVSWarnNetIsFirst)' != 'true'
AND '$(BuildingInsideVisualStudio)' == 'true'
Expand Down

0 comments on commit 5e6c681

Please sign in to comment.