AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

Import-Module issue: Assembly with the same name is already loaded #16

Closed pmatthews05 closed 3 years ago

pmatthews05 commented 3 years ago

Attempting to install your powershell module and unable to get it working.

I install the module using

Install-module -name MSAL.PS

I accepted the untrusted repository and accept license.

Then when I attempt to run a command

Get-MsalToken

I get the error message

Get-msaltoken: The 'Get-msaltoken' command was found in the module 'MSAL.PS', but the module could not be loaded. For more information, run 'Import-Module MSAL.PS'.

So I then attempt to import the module

Import-Module MSAL.PS -verbose

and the output is

VERBOSE: Loading module from path 'c:\Users\Me\Documents\powershell\Modules\MSAL.PS\4.16.0.3\MSAL.PS.psd1'.
VERBOSE: Loading 'Assembly' from path 'c:\Users\Me\Documents\powershell\Modules\MSAL.PS\4.16.0.3\Microsoft.Identity.Client.4.16.0\net45\Microsoft.Identity.Client.dll'.
VERBOSE: Loading 'Executable' from path 'c:\Users\Me\Documents\powershell\Modules\MSAL.PS\4.16.0.3\net45\Microsoft.Identity.Client.dll'.
VERBOSE: Loading 'Assembly' from path 'c:\Users\Me\Documents\powershell\Modules\MSAL.PS\4.16.0.3\Microsoft.Identity.Client.4.16.0\netcoreapp2.1\Microsoft.Identity.Client.dll'.
VERBOSE: Loading 'Executable' from path 'c:\Users\Me\Documents\powershell\Modules\MSAL.PS\4.16.0.3\Microsoft.Identity.Client.4.16.0\netcoreapp2.1\Microsoft.Identity.Client.dll'.
Import-Module: Assembly with same name is already loaded

I have attempted to install this on 3 different machines, attempted using PowerShell ISE, Powershell 7, and Powershell inside codespaces all return the same message.

Note: PowerShell 7 was newly installed

Is there an issue, or am I doing something wrong?

Happy to provide more information if required.

darrenjrobinson commented 3 years ago

I'm seeing the same thing @pmatthews05 @jasoth there seems to be an issue with the latest release 4.16.0.3 on PowerShell 7.0.x.

Module imports fine in Windows PowerShell

image

Version 4.16.0.2 imports fine in PowerShell 7.0.3

image

BUT 4.16.0.3 bombs on import on PowerShell 7.0.3

image

jazuntee commented 3 years ago

Thank you both for reporting this. I have unlisted 4.16.0.3 from PS Gallery and rereleased with the fix in 4.16.0.4.

darrenjrobinson commented 3 years ago

Champion, thx @jasoth Working for me now @pmatthews05 with v 4.16.0.4

image

pmatthews05 commented 3 years ago

Thank you @jasoth & @darrenjrobinson

It is working for me now too with the new version v4.16.0.4.

bchap1n commented 1 year ago

Thank you both for reporting this. I have unlisted 4.16.0.3 from PS Gallery and rereleased with the fix in 4.16.0.4.

excellent! I ran into this issue and was running the msal cmdlets in a Powershell Job as a workaround.