Skip to content

[Bug] Cannot compile Windows MAUI .NET 9 project when referencing Microsoft.Identity.Client.Desktop #4993

Open
@superwilly1

Description

Library version used

4.66.2

.NET version

.NET 9 MAUI

Scenario

Other - please specify

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

Today we updated our MAUI app from .NET 8 to .NET 9.
Android and iOS are fine, but Windows does not work with the Microsoft.Identity.Client.Desktop package.
The app cannot compile, showing these error messages:
Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: System.Xaml, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.'
and:
Could not copy the file "C:\temp\NET9MAUIWindowsIssue\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\Platforms\Windows\App.xbf" because it was not found.

These errors also occur in a file->new->MAUI project, and only adding the package reference.
No code changed in the new MAUI app, only added the package reference.
See the example project in the attached zipfile:
NET9MAUIWindowsIssue.zip

Only the Desktop package is an issue, these packages work:

<PackageReference Include="Microsoft.Identity.Client" Version="4.66.2" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.66.2" />

Relevant code snippets

Only change needed to reproduce is to add this to the .csproj file (of an empty new .NET MAUI project), referencing the NuGet package:

<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
	<PackageReference Include="Microsoft.Identity.Client.Desktop" Version="4.66.2" />
</ItemGroup>

Expected behavior

The app should compile (and work) on .NET9, like it also used to work on .NET8.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No solution or workaround as of yet.

Metadata

Assignees

No one assigned

    Labels

    needs attentionDelete label after triageuntriagedDo not delete. Needed for Automation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions