Skip to content

Commit

Permalink
fix: Add msal fix for MSALClientException
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklimakc committed Dec 2, 2024
1 parent eb7986b commit bc451e1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44",
"Uno.Sdk": "5.3.96"
"Uno.Sdk": "5.5.49"
}
}
3 changes: 2 additions & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.61.3" />
<PackageVersion Include="Microsoft.Identity.Client.Desktop" Version="4.61.3" />
<PackageVersion Include="Microsoft.Maui.Controls" Version="8.0.3" />
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
Expand Down Expand Up @@ -49,7 +50,7 @@
<PackageVersion Include="Uno.Extensions.Markup.Generators" Version="5.3.12" />
<PackageVersion Include="Uno.Extensions.Markup.WinUI" Version="5.3.12" />
<PackageVersion Include="Uno.Roslyn" Version="1.3.0-dev.12" />
<PackageVersion Include="Uno.Toolkit" Version="6.1.8" />
<PackageVersion Include="Uno.Toolkit" Version="6.3.6" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UI.RuntimeTests.Engine" Version="0.37.0-dev.126" />
<PackageVersion Include="Uno.WinUI" Version="$(UnoVersion)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

#if WINDOWS
using Microsoft.Identity.Client.Desktop;
#endif
using Uno.Extensions.Logging;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
#if UNO_EXT_MSAL
Expand Down Expand Up @@ -46,6 +48,11 @@ public void Build()
if (Logger.IsEnabled(LogLevel.Trace)) Logger.LogTraceMessage($"Configuring Web RedirectUri");
builder.WithWebRedirectUri();
}

#if WINDOWS
builder.WithWindowsEmbeddedBrowserSupport();
#endif

builder.WithUnoHelpers();

_pca = builder.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" />
</ItemGroup>

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

<ItemGroup Condition="'$(IsBrowserWasm)'!='true'">
<Compile Remove="**\*.wasm.cs"/>
</ItemGroup>
Expand Down
28 changes: 0 additions & 28 deletions src/Uno.Extensions.Authentication.MSAL/build/Package.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,4 @@
<DefineConstants>$(DefineConstants);UNO_EXT_MSAL</DefineConstants>
</PropertyGroup>

<!--
This is a temporary workaround to avoid error "NETSDK1152: Found multiple publish output files with the same relative path:"
for Microsoft.Web.WebView2.Core.dll, with one coming from MsixContent and the other from the Microsoft.Web.Webview2 Nuget package.
If both are present, we only keep the one from the NuGet package. See https://github.com/unoplatform/uno/issues/14555.
-->
<Target Condition="$(UnoMsalWebView2Workaround) == 'true'" Name="ResolveWebView2CoreDuplicates1" BeforeTargets="_ComputeResolvedFilesToPublishTypes" AfterTargets="ComputeFilesToPublish">
<Message Importance="high" Text ="Applying workaround to resolve Microsoft.Web.WebView2.Core.dll duplication in package (1)" />
<ItemGroup>
<_WebView2CoreFilesToExclude Include="@(ResolvedFileToPublish)" Condition="'%(Filename)' == 'Microsoft.Web.WebView2.Core'"/>
</ItemGroup>
<ItemGroup Condition="'@(_WebView2CoreFilesToExclude->Count())' &gt; 1">
<_WebView2CoreFilesToExclude Remove="@(_WebView2CoreFilesToExclude)" Condition="$([System.String]::Copy(%(FullPath)).Contains('.nuget'))"/>
<ResolvedFileToPublish Remove="@(_WebView2CoreFilesToExclude)" />
</ItemGroup>
<Message Importance="high" Text ="Removed: @(_WebView2CoreFilesToExclude)" />
</Target>

<Target Condition="$(UnoMsalWebView2Workaround) == 'true'" Name="ResolveWebView2CoreDuplicates2" BeforeTargets="_ComputeAppxPackagePayload" AfterTargets="GetPackagingOutputs">
<Message Importance="high" Text ="Applying workaround to resolve Microsoft.Web.WebView2.Core.dll duplication in package (2)" />
<ItemGroup >
<_WebView2CoreOutputsToExclude Include="@(PackagingOutputs)" Condition="'%(Filename)' == 'Microsoft.Web.WebView2.Core'"/>
</ItemGroup>
<ItemGroup Condition="'@(_WebView2CoreOutputsToExclude->Count())' &gt; 1">
<_WebView2CoreOutputsToExclude Remove="@(_WebView2CoreOutputsToExclude)" Condition="$([System.String]::Copy(%(FullPath)).Contains('.nuget'))"/>
<PackagingOutputs Remove="@(_WebView2CoreOutputsToExclude)" />
</ItemGroup>
<Message Importance="high" Text ="Removed: @(_WebView2CoreOutputsToExclude)" />
</Target>
</Project>

0 comments on commit bc451e1

Please sign in to comment.