AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

Assembly conflict #38

Closed ypanson5 closed 2 years ago

ypanson5 commented 2 years ago

Whenever I run any command in this module, I get the assembly conflict warning below:

WARNING: Assembly with same name "Microsoft.Identity.Client.Desktop.dll" is already loaded:
C:\Program Files\WindowsPowerShell\Modules\MSAL.PS\4.35.1.3\Microsoft.Identity.Client.Desktop.4.35.1\net461\Microsoft.Identity.Client.Desktop.dll

Ignore assembly conflict and continue importing module?
Some module functionality will not work.
[Y] Yes  [N] No  [?] Help (default is "N"): Y

Remember settings?
Module settings will be persisted in "C:\Users\•••••••\AppData\Roaming\MSAL.PS\config.json"
[Y] Yes  [N] No  [?] Help (default is "N"): Y

This will be remembered and not prompting within the same PowerShell window, but on a new PowerShell window, it is prompting the same warning again.

I tried providing the module settings on import, which suppressed the prompt, but the warning still shows. At least now I can schedule the script to run without stuck at the interactive prompt. But what should I do to fix this warning? Import-Module -Name MSAL.PS -ArgumentList @{ 'dll.lenientLoading' = $true; 'dll.lenientLoadingPrompt' = $false }

Thanks, Anson

jazuntee commented 2 years ago

For some reason, the assembly conflicts with itself on certain versions of Windows. I added a fix to ignore the self-conflict. However, when there is a legitimate conflict, the warning will always display. The remember setting is only there to allow you continue without interaction. There was also a bug in writing the settings to file which is why it prompted you every time. That should be fixed now as well.