Microsoft.Identity.Client.Desktop

Giorgio Sfiligoi 326 Reputation points
2025-03-11T15:48:29.09+00:00

I successfully tested the sample https://github.com/Azure-Samples/ms-identity-dotnetcore-maui/tree/main/MauiAppBasic in .NET MAUI 8.0.

Now I would like to create my own project using the same technique.

To begin with, I created an empty project, then I started loading the required libraries. When I load Microsoft.Identity.Client.Desktop I get an error:

"The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so."

Indeed from document https://learn.microsoft.com/en-us/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam I learn that MAUI does not support this library; this leads me to two questions:

  1. How is that the sample compiles and runs without raising that error?
  2. How can I sort out this issue in my project?

Although my project is targeted to Android, I would like to have the multi-platform capability that in principle MAU offers.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,994 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.