AzureAD / microsoft-authentication-library-for-dotnet

Microsoft Authentication Library (MSAL) for .NET
https://aka.ms/msal-net
MIT License
1.37k stars 338 forks source link

[Bug] The msalruntime.dll library is NOT included in the ClickOnce publish folder #4369

Open luronumen opened 11 months ago

luronumen commented 11 months ago

Library version used

4.56.0

.NET version

.NET Framework 4.8

Scenario

PublicClient - desktop app

Is this a new or an existing app?

None

Issue description and reproduction steps

  1. Create a Windows Forms App (.NET Framework) project (e.g.: WindowsFormsApp1) using Visual Studio Professional 2022 (Version 17.7.4)
  2. Install the Microsoft.Identity.Client.Broker and Microsoft.Identity.Client.Extensions.Msal NuGet packages
  3. Right click on References and select Migrate packages.config to PackageReference...
  4. Go to Project Properties > Build and set Platform Target to x64 for Debug and Release Configurations
  5. Build the project: Verify that msalruntime.dll library is included in the (Debug|Release), (Debug|Release)\runtimes\win-arm64\native, (Debug|Release)\runtimes\win-x64\native, (Debug|Release)\runtimes\win-arm64\native folders
  6. Go to Project Properties > Publish > Application Files...: verify that msalruntime.dll library is listed to be included when the application is published:

01

  1. Back to Publish and the click on Publish Now button to publish it: verify that msalruntime.dll library is NOT included in the _publish\Application Files\WindowsFormsApp1_1_0_00 folder

02

For more details please check the source code: WindowsFormsApp1.zip

Relevant code snippets

No response

Expected behavior

The msalruntime.dll library should be included in the ClickOnce publish folder

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

quails4Eva commented 9 months ago

Any timescale for when this is likely to be fixed? Or any workaround until it is?

bgavrilMS commented 9 months ago

Hi @quails4Eva - did you try with the latest MSAL 4.58? Does it still repro? We made a small change related to how the native binary is located and loaded, but I am not sure it fixes this issue.

quails4Eva commented 9 months ago

Hi @bgavrilMS , thanks for the quick response, just tried it and still getting the same issue unfortunately.

quails4Eva commented 9 months ago

Another thing to note. My app targets Any CPU and I don't see msalruntime.dll in the list under Publish -> Application Files. Changing to x64 makes it show in the list, but still doesn't include it when publishing. (Plus changing from Any CPU to x64 would require a reinstall of the app which I'd rather avoid if possible.)

grleachman commented 6 months ago

I've run into this as will using PackageReference Include="Microsoft.Identity.Client" Version="4.59.0"

.net 6.0

workaround for me is to copy the file from the bin/release/runtimes/win-x64/native into the deployed folder.

Thanks