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

[Feature Request] [L] Support for Windows WinUI 3 desktop apps #2673

Closed
andrewleader opened this issue Jun 2, 2021 · 31 comments
Closed

[Feature Request] [L] Support for Windows WinUI 3 desktop apps #2673

andrewleader opened this issue Jun 2, 2021 · 31 comments

Comments

@andrewleader
Copy link

The Microsoft.Identity.Client library doesn't support Windows WinUI 3 desktop Project Reunion apps today. I think the library is seeing the net5.0-windows TFM and thinking it's a WPF or WinForms app, and therefore doesn't work with a WinUI 3 app (which is neither of those).

Describe the solution you'd like
Microsoft.Identity.Client library works with WinUI 3 desktop apps.

Additional context
To reproduce...

  1. First set up dev environment (install Reunion VSIX): https://docs.microsoft.com/en-us/windows/apps/project-reunion/set-up-your-development-environment
  2. Then create a WinUI desktop app: https://docs.microsoft.com/en-us/windows/apps/winui/winui3/get-started-winui3-for-desktop
  3. Then add the Microsoft.Identity.Client NuGet package to the app and attempt to build and run the app
@bgavrilMS bgavrilMS added this to the 4.33.0 milestone Jun 2, 2021
@bgavrilMS bgavrilMS self-assigned this Jun 2, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] Support for Windows WinUI 3 desktop apps [Feature Request] L] Support for Windows WinUI 3 desktop apps Jun 3, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] L] Support for Windows WinUI 3 desktop apps [Feature Request] [L] Support for Windows WinUI 3 desktop apps Jun 3, 2021
@bgavrilMS bgavrilMS removed their assignment Jun 17, 2021
@pmaytak pmaytak modified the milestones: 4.33.0, 4.34.0 Jun 23, 2021
@trwalke trwalke modified the milestones: 4.34.0, 4.35.0 Jul 8, 2021
@igalfsg
Copy link

igalfsg commented Jul 15, 2021

Is this planned for 4.35.0?

@jmprieur
Copy link
Contributor

It's going to be investigated first. We need to understand what needs to be done, @igalfsg
If you know already, don't hesitate to provide hints.

@igalfsg
Copy link

igalfsg commented Jul 17, 2021

@jmprieur I haven't looked into the library's code. However, version 4.27.1 still works with Win UI 3. That was before it was switched from the in app prompt to browser authentication so I would guess it has something to do with how that feature was implemented.

@trwalke trwalke self-assigned this Jul 23, 2021
@pmaytak pmaytak modified the milestones: 4.35.0, 4.36.0 Jul 27, 2021
@trwalke
Copy link
Member

trwalke commented Jul 29, 2021

The same issue seems to be open in the Microsoft.UI.XAML repo
microsoft/microsoft-ui-xaml#5143

I also tried using VS 2022 to build but I run into the same error

@bgavrilMS
Copy link
Member

This is most likely due to WinUI. MSAL has a tfm of net5.0-windows10.0.17763.0 and WinUI app has net5.0-windows10.0.19xxx. MSAL calls into WinRT on its own.

@marb2000
Copy link

marb2000 commented Aug 2, 2021

I couldn't repro the bug. I created a Blank C# WinUI 3 app using the Windows App SDK 0.8.1, added the MSAL.NET library, and the project was built. I got an error that does not block the build. WinUI 3 supports arm64 and I guess MASL.NET doesn't:

There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'win10-arm64'.

@trwalke
Copy link
Member

trwalke commented Aug 2, 2021

Thanks @marb2000. Ill verify that I installed 0.8.1 and try again.

@jmiddour
Copy link

jmiddour commented Aug 6, 2021

I can confirm that the behavior still remains. I don't know if it's WinUI's issue to fix or the identity client.
I've messed with the tfms and runtime ids a lot, and haven't gotten a working combination with v4.35 yet running vs16.11 preview. Though for me, the missing runtime pack is a build blocker.

@bgavrilMS
Copy link
Member

This is unlikely to be a Microsoft.Identity.Client problem. The error comes from a targets file introduced by WinUI

Microsoft.UI.Xaml.Markup.Compiler.interop.targets(465,9): Xaml Internal Error error WMC9999: **Operation is not supported on this platform.

MSAL is a standard .NET library with a target on .net5-windows10.0.17763.0, which calls into WinRT APIs.

@hachadwick
Copy link

I am not sure if this has been stated before but, I am able to use Microsoft.Identity.Client version 4.27.1 without issue in my WINUI 3 app. If I use a version later than that, I get an build error. It appears the issue was introduced in version 4.28.0, possibly.

@bgavrilMS
Copy link
Member

The issue should have been fixed @hachadwick , we're waiting for an SDK that has the fix to verify this.

@hachadwick
Copy link

The issue should have been fixed @hachadwick , we're waiting for an SDK that has the fix to verify this.

I appreciate the reply. I'll be looking for the updated SDK.

@hachadwick
Copy link

Will this issue/ticket be closed when the SDK is updated?

@andrewleader
Copy link
Author

@bgavrilMS you can use 1.0.0-preview2 of the WinAppSDK, that has the fix and is publicly available now.

@bgavrilMS
Copy link
Member

bgavrilMS commented Oct 12, 2021

@trwalke was looking into this, he'll can give it a go early next week.

@pmaytak pmaytak modified the milestones: 4.37.0, 4.38.0 Oct 23, 2021
@trwalke
Copy link
Member

trwalke commented Oct 29, 2021

Need to do basic smoke testing to ensure new preview works

@trwalke trwalke modified the milestones: 4.38.0, 4.39.0 Nov 19, 2021
@pmaytak pmaytak modified the milestones: 4.39.0, 4.40.0 Nov 29, 2021
@pmaytak pmaytak removed this from the 4.40.0 milestone Jan 11, 2022
@emorell96
Copy link

This has come back now with MAUI in RC1: dotnet/maui#6052
The build fails with two errors when MSAL is added to a MAUI library. Any idea how to avoid building for arm? I have no need to support arm on windows.

2>C:\Program Files\dotnet\sdk\6.0.300-preview.22204.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(427,5): error NETSDK1082: There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'win10-arm'.
2>C:\Program Files\dotnet\sdk\6.0.300-preview.22204.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(427,5): error NETSDK1082: There was no runtime pack for Microsoft.WindowsDesktop.App.WindowsForms available for the specified RuntimeIdentifier 'win10-arm-aot'.

@bgavrilMS
Copy link
Member

This works today, there is nothing to do.

@diemperdiem
Copy link

So I'm using WinUI in .NET 6.0-pre (net6.0-windows10.0.19041) as part of the standard project template that shipped with MAUI Preview 7. It's using ProjectReunion 0.8.1.

I get a hard crash in my Startup.ConfigureServices routine when trying to build a IPublicClientApplication using Microsoft.Identity.Client.

Having read through this post I have tried various versions of the Microsoft.Identity.Client library:

  • 4.34.1
  • 4.27.1
  • 4.16.1 (just for luck)
  • 4.10.1 (just for luck)

None workaround the issue.

Because it's a hard crash I've been unable to catch the exception using a TRY/CATCH block.

I know most of the conversation here has revolved around compatibility with .NET 5.0 but I'm wondering if anyone has any ideas for a workaround for .NET 6.0 / MAUI Preview 7, please?

Cheers.

@PaulSorauer-IPG Any luck?

@bgavrilMS
Copy link
Member

@diemperdiem - we expect this to work. Please open a new bug if it isn't.

@rossirpaulo
Copy link

Should not be closed. This does not work if WindowsAppSDKSelfContained is set to true.

@bgavrilMS
Copy link
Member

@rossirpaulo - please open a bug for this

@baskren
Copy link

baskren commented Feb 9, 2023

Here is the bug : #3941
Why it's closed is a mystery to me.

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

No branches or pull requests