This app is a minimum WPF app to reproduce the error 'Unable to load DLL 'msalruntime' when trying to follow this doc to use the new version (4.49.1-preview) of Microsoft.Identity.Client.Broker
.
- Clone this repo.
- Build the solution to restore all nuget packages.
- Start the project "WPF" project.
- You will be displayed with a window with a button and a text box
- Click on the
Acquire Token Interactively
button
Result : You should now see the Windows Web Account Manager UI showing up and prompting you to sign in to the app. You can use the MS Credentials or use the following user details to sign-in. But sign in is actually not required. The WAM (Web Account Manager) UI is from the Native dll (msalruntime.dll) packaged along with Microsoft.Identity.Client.Broker
Identity Lab Account User Name : [email protected]
Identity Lab Account Password : https://msidlab.com/api/LabSecret?&Secret=msidlab4 (Please do not share this secret or add it to your response)
- Now set the
WPF.Package
as the start up project - Start the project "WPF.Package" project.
Microsoft.Identity.Client.MsalClientException: 'Unable to load DLL 'msalruntime': The specified module could not be found. (Exception from HRESULT: 0x8007007E) See https://aka.ms/msal-net-wam#troubleshooting'
Inner Exception
DllNotFoundException: Unable to load DLL 'msalruntime_x86': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Alternative Repro :
You can also deploy the package and launch it, this will crash the app. And App logs will show the same error
Investigation so far:
WPF project gets the runtimes folder and it's contents (msalruntime native dlls)
AppX also contains the runtimes folder and it's contents
Fix we have done :
- Manually copy the dlls from the runtimes folder and place them in the executing assembly directory
- deploy the package
- Launch the app. It will work as expected