-
Notifications
You must be signed in to change notification settings - Fork 340
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
Initial changes to add support for .NET MAUI #3262
Conversation
you probably need to install .NET MAUI Workloads to build the lib: |
hello, I had to make the necessary changes to make MSAL work on .net6 for one of my MAUI app (ios, android). I made it for internal use (please don't judge the code :) ), however when I saw you're working on maui support, I thought I share it. I also had to recompile Xamarin.Google.Guava.ListenableFuture but I think the latest version(1.0.0.7) should be fine. Please let me know if there is anything I could do with my branch, to make it useful for you. |
Hi all, what's the progress on this PR? It's mindboggling that Maui has shipped and that there's no MSAL support 🤦♂️ |
|
@@ -17,7 +17,7 @@ public HttpClient GetHttpClient() | |||
|
|||
var httpClient = new HttpClient( | |||
// As per Xamarin guidance https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=windows | |||
new Xamarin.Android.Net.AndroidClientHandler()); | |||
new Xamarin.Android.Net.AndroidMessageHandler()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break older Xamarin applications that target sdk<12
https://docs.microsoft.com/en-us/dotnet/api/xamarin.android.net.androidmessagehandler?view=xamarin-android-sdk-12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SameerK-MSFT - shouldn't this be added only to MAUI?
src/client/Microsoft.Identity.Client/Platforms/Android/AndroidLegacyCachePersistance.cs
Show resolved
Hide resolved
src/client/Microsoft.Identity.Client/Platforms/Android/AndroidPlatformProxy.cs
Show resolved
Hide resolved
@@ -12,14 +12,6 @@ | |||
<PropertyGroup Condition="'$(MSAL_DESKTOP_ONLY_DEV)' == ''"> | |||
|
|||
<TargetFrameworkNetStandard>netstandard1.3</TargetFrameworkNetStandard> | |||
<TargetFrameworkNetDesktop45>net45</TargetFrameworkNetDesktop45> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo this, we cannot remove legacy frameworks, except maybe net45. I'd prefer to remove net45 in a separate commit.
|
||
<!-- net6.0 (MAUI) --> | ||
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.0-'))"> | ||
<DefineConstants>$(DefineConstants);MAUI</DefineConstants> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this constant - use NET6 if applicable to all net6 platforms. Otherwise use a platform specific constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, net6-android/ios/maccatalyst are quite different than net6. For example we don't expose Confidential Client flows on mobile / desktop targets, because servers don't run there. So we do need a target.
But generally, I gree that we should remove this constnant. We should use constants like SUPPORTS_CONFIDENTIAL_CLIENT etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you call this constant XAMARIN
or MOBILE
. Choosing the word MAUI
assumes the exclusion of the xamarin native platforms or other tools in the ecosystem such as Uno Platform, Avalonia, etc.
I pulled this code to see how well it works with Uno Platform .NET 6 and WinUI
I am not sure what is going on with MacOS as the debugging experience is a little lacking when launching it from the .NET CLI but it fails to load the login window. I took the exact same code and loaded it into the older style Xamarin macOS projects (pre-net6) and it worked as expected using v4.39.0 |
A similar PR was merged yesterday with support for net6-android net6-ios and net6-maccatalyst. CLosing this one. |
I built a simple Maui solution directly from the Visual Studio template. I added the Microsoft.Identity.Client NuGet package and added this code to MainPage.xaml.cs:
Got this error:
I have all the latest NuGet packages, even tried looking for pre-releases. |
I'm unable to build from your repository. Is there any chance you can either post instructions on how to build, or actually publish the NuGet package? |
@DRAirey1 - you don't need to build MSAL manually, we have a preview version published to nuget - https://www.nuget.org/packages/Microsoft.Identity.Client/4.46.0-preview2 And a rough sample: https://github.com/Azure-Samples/active-directory-xamarin-native-v2/tree/main/MAUI |
Alright. That seems to have compiled and linked. Thanks. |
MAUI support - #3127
Blocking issues: