microsoft-authentication-library-for-dotnet
microsoft-authentication-library-for-dotnet copied to clipboard
[Bug] PackageReference to Microsoft.Web.WebView2 in project causes CoreWebView2 name collision when used with Microsoft.WinUI library in WinUI app
Library version used
4.64.0
.NET version
Microsoft.WindowsAppSDK 1.5.240802000 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
Scenario
PublicClient - desktop app
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
Upgrading to the latest version of the Microsoft.IdentityClient and Microsoft.Identity.Client.Extensions.Msal (version 4.64.0 for both libraries) in a WinUI app built on the Microsoft.WindowsAppSDK 1.5.240802000 causes the following error on Compile.
error CS0433: The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core.Projection, Version=1.0.2739.15, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
downgrade to the previous build and the error goes away. My project doesn't have a reference to the Microsoft.Web.WebView2.Core.Projection
library, so this reference is getting brought in by MSAL.
see the source in GitHub for the .csproj
Relevant code snippets
No response
Expected behavior
upgrading to the latest library would not break my WinUI app
Identity provider
Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)
Regression
worked in 4.63.0
Solution and workarounds
I've tried everything I can to hide the reference you have added from my projects compile. Until the differing folks and teams at Microsoft can agree on exactly WHERE the WebView2 name spaces are going to live, maybe you could alias it in your project?