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

Enable .NET 8 for uwp MultiTarget, upgrade packages #235

Open
wants to merge 87 commits into
base: main
Choose a base branch
from

Conversation

Arlodotexe
Copy link
Member

@Arlodotexe Arlodotexe commented Dec 3, 2024

For components that declare a uwp MultiTarget, this PR:

  • Introduces the net8.0-windows10.0.26100.0 TFM alongside the existing uap10.0.17763
  • Auto-enables the required properties for targeting modern dotnet in uwp
  • Updates several platform packages to versions that support modern dotnet on uwp
  • Adds several workarounds and fixes to get builds working again with all the latest tooling

…to head, removed redundant RuntimeIdentifiers definition on libraries.
@Arlodotexe
Copy link
Member Author

It would appear that adding the modern .NET for UWP TFM results in our gallery app being unbuildable in uap mode:

4>C:\Users\arlog\.nuget\packages\microsoft.windows.sdk.cpp\10.0.26100.2454\c\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(383,13): error MSB4064: The "UsingCsWinRT" parameter is not supported by the "CompileXaml" task loaded from assembly: Microsoft.Windows.UI.Xaml.Build.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 from the path: C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Build.Tasks.dll. Verify that the parameter exists on the task, the <UsingTask> points to the correct assembly, and it is a settable public instance property.
4>C:\Users\arlog\.nuget\packages\microsoft.windows.sdk.cpp\10.0.26100.2454\c\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(354,5): error MSB4063: The "CompileXaml" task could not be initialized with its input parameters.
4>Done building project "Converters.Samples.csproj" -- FAILED.

Starting with the 10.0.20348 SDK, the version of the tasks assembly is always 0.0.0.0, which is why VS can't tell the different newer versions apart.

An issue has been filed for the platform here (thanks to @Sergio0694 for helping here).

In the meantime, we'll have to employ a workaround to get the gallery buildable again. The code should be functionally identical to uap10.*, and NativeAoT changes should be functionally identical to those made for the Windows App SDK and Uno Platform.

Since this is just an issue with Visual Studio, the workaround we're looking at is to disable modern .NET for UWP for local development and only enable it for build in the CI. When the issue is resolved, we can enable it again for local testing and build.

@Arlodotexe
Copy link
Member Author

Looks like this has fixed our problem with Sample and Source component projects not compiling in Visual Studio, but similar issues remain on the head itself.

The package Microsoft.Windows.SDK.CPP is being used to bring us SDK changes early and may be part of the problem/solution here.

A few observations:

As of 218a656, building the Sample Gallery for uwp results in:

3>C:\Users\arlog\.nuget\packages\microsoft.windows.sdk.cpp\10.0.26100.2454\c\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(354,5): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.
========== Build: 2 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

If we revert 7625ac5 and only include this package on modern .net (not uap), we get the error message:

3>C:\Users\arlog\.nuget\packages\microsoft.windows.sdk.cpp\10.0.26100.2454\c\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(383,13): error MSB4064: The "UsingCsWinRT" parameter is not supported by the "CompileXaml" task loaded from assembly: Microsoft.Windows.UI.Xaml.Build.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 from the path: C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Build.Tasks.dll. Verify that the parameter exists on the task, the <UsingTask> points to the correct assembly, and it is a settable public instance property.
3>C:\Users\arlog\.nuget\packages\microsoft.windows.sdk.cpp\10.0.26100.2454\c\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(354,5): error MSB4063: The "CompileXaml" task could not be initialized with its input parameters. 
========== Build: 2 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

Removing this package reference entirely results in an error similar to the latest commit:

3>C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(322,5): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.

@Arlodotexe
Copy link
Member Author

Seems like a proper fix will require a bugfix from the platform, we'll need to continue searching for a workaround here.

218a656 was good progress and did fix some things, but we're finding that the changes here are still causing problems when building the UWP head. Locally, when running a build in VS with modern .NET on UWP seemingly completely removed (no TFMs, no UseUwp, no extra package references), we still get the build error:

51>(MarkupCompilePass1 target) -> 
51>  C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(322,5): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.

Main builds fine, so there's additional changes in this branch that are causing this. Investigating.

@Arlodotexe
Copy link
Member Author

CI is blocked by this error. Cause unknown, needs investigation.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants