I also agree with trying to find a more permanent solution. I’ve considered some sort of module validation automation. We could do some sort of scan to of the PS Gallery for updates to popular modules, install them in PSU (maybe even a mix of them) and then do a couple operations to catch these basic failures. We could then publish the report so you could see which versions of which modules work with PSU.
Without this, it is a never-ending moving target on either end.
Looks like this started happening again with PSU 5.5.1
PS>TerminatingError(Add-Type): “Cannot add type. Compilation errors occurred.”
PS>TerminatingError(Get-ConnectionContext): “One or more errors occurred. (Could not load file or assembly ‘Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040))”
PS>TerminatingError(): “Could not load file or assembly ‘Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040)”
[ERROR] Failed to connect to Exchange Online: Could not load file or assembly ‘Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040)
I was encountering the above error you mentioned, but none of my modules are installed via PSU. I prepped the server with all the dependencies of the scripts before I installed PSU. Using the integrated environment instead of the Powershell 7 environment managed to get the script to run. I’m not sure what that indicates about the problem though. I just upgraded from 2.9 to 5.5, so I’m still not super familiar with the new way the environments are being done.
I was able to install ExchangeOnlineManagement module outside of PSU in PS 5.1 then ran the scripts in PSU as PS 5.1 and its working. Doesn’t work with integrated or PS7 for me.