dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Update Windows SDK projection for testing #25781

Open manodasanW opened 1 week ago

manodasanW commented 1 week ago

Description of Change

PR for testing latest Windows SDK projection package

Issues Fixed

Fixes #

dotnet-policy-service[bot] commented 1 week ago

Hey there @manodasanW! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

jsuarezruiz commented 1 week ago

/azp run

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 3 pipeline(s).
rmarinho commented 1 week ago

@mattleibow you remember anything about getting this working ?

manodasanW commented 1 week ago

I took a look at the binlog and it seems the WindowsSdkPackageVersion set in Directory.Build.Props is not taking effect in all projects as I would expect. It does take effect for some. I see that in the below property group, _MauiTargetPlatformIsWindows is actually false even though Compatibility.ControlGallery.WinUI is targeting the Windows TFM and I do see the correct TFM in the binlog. It seems _MauiTargetPlatformIdentifier is empty which is what is used to set the property.

I wonder if this is some ordering issue for when the TargetFramework gets populated and the Directory.Build.Props running.

  <PropertyGroup Condition="'$(_MauiTargetPlatformIsWindows)' == 'True'">
    <WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion>
  </PropertyGroup>
    <_MauiTargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</_MauiTargetPlatformIdentifier>
manodasanW commented 1 week ago

I took an attempt at trying to address the issue where TargetFramework may not be set yet when Directory.Build.props is run. Not sure if it is going to break anything elsewhere in the cases where it did get set properly but worth seeing what happens in the pipelines.

jsuarezruiz commented 1 week ago

/azp run

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 3 pipeline(s).
manodasanW commented 1 week ago

I believe the current breaks are due to https://github.com/dotnet/maui/blob/353f1a3064d256f2d31465ab86259edd78c59cb6/src/MultiTargeting.targets#L26 is getting imported before Directory.Build.targets runs as it is explicitly imported by the csproj.

mattleibow commented 1 week ago

Why were all the props moved to the targets file?

manodasanW commented 1 week ago

Why were all the props moved to the targets file?

See this comment. I was basically trying a change to address the issue where TargetFramework wasn't set when Directory.Build.Props got imported for Compatibility.ControlGallery.WinUI causing for those props to be false. It might be we need to continue setting it in the props and then reset it in targets if empty.

PureWeen commented 2 days ago

/azp run MAUI-public

azure-pipelines[bot] commented 2 days ago
Azure Pipelines successfully started running 1 pipeline(s).
PureWeen commented 2 days ago

/rebase

PureWeen commented 2 days ago

/azp run MAUI-public

azure-pipelines[bot] commented 2 days ago
Azure Pipelines successfully started running 1 pipeline(s).
manodasanW commented 2 days ago
CSC : error CS1705: Assembly 'Microsoft.Maui.Graphics' with identity 'Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'WinRT.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' which has a higher version than referenced assembly 'WinRT.Runtime' with identity 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' [D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.WinUI.Desktop\GraphicsTester.WinUI.Desktop.csproj]
C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.6.240923002\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(841,9): error MSB3073: The command ""C:\Users\cloudtest\.nuget\packages\microsoft.windowsappsdk\1.6.240923002\buildTransitive\..\tools\net6.0\..\net472\XamlCompiler.exe" "D:\a\_work\1\s\artifacts\obj\GraphicsTester.WinUI.Desktop\Release\net9.0-windows10.0.19041.0\win10-x64\\input.json" "D:\a\_work\1\s\artifacts\obj\GraphicsTester.WinUI.Desktop\Release\net9.0-windows10.0.19041.0\win10-x64\\output.json"" exited with code 1. [D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.WinUI.Desktop\GraphicsTester.WinUI.Desktop.csproj]
CSC : error CS1705: Assembly 'Microsoft.Maui.Controls' with identity 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'WinRT.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' which has a higher version than referenced assembly 'WinRT.Runtime' with identity 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' [D:\a\_work\1\s\src\Compatibility\ControlGallery\src\WinUI\Compatibility.ControlGallery.WinUI.csproj]
CSC : error CS1705: Assembly 'Microsoft.Maui' with identity 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'WinRT.Runtime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' which has a higher version than referenced assembly 'WinRT.Runtime' with identity 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709' [D:\a\_work\1\s\src\Compatibility\ControlGallery\src\WinUI\Compatibility.ControlGallery.WinUI.csproj]
    9436 Warning(s)
    4 Error(s)

Build failing https://dev.azure.com/xamarin/public/_build/results?buildId=128682&view=logs&j=5239058e-6f59-5db5-6c0e-6f79eefcd049&t=fc7fa7a5-d064-56f1-1e61-2467ac63450b&l=26075

That is related to the below comment.

I took a look at the binlog and it seems the WindowsSdkPackageVersion set in Directory.Build.Props is not taking effect in all projects as I would expect. It does take effect for some. I see that in the below property group, _MauiTargetPlatformIsWindows is actually false even though Compatibility.ControlGallery.WinUI is targeting the Windows TFM and I do see the correct TFM in the binlog. It seems _MauiTargetPlatformIdentifier is empty which is what is used to set the property.

I wonder if this is some ordering issue for when the TargetFramework gets populated and the Directory.Build.Props running.

  <PropertyGroup Condition="'$(_MauiTargetPlatformIsWindows)' == 'True'">
    <WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion>
  </PropertyGroup>
    <_MauiTargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</_MauiTargetPlatformIdentifier>