Howdy all!
I’m getting a strange (to me) error when tryin to run a post deployment script with a 3rd party PowerShell module:
2022-09-03 14:01:29.824 -07:00 [ERR] Error: Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=6.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\MipSdkRedist\22.2.0\MipSdkRedist.psm1: line 1
at <ScriptBlock>, C:\Scripts\PostDeplyScript.ps1: line 23
The script fails when it tries to import the MilestonePSTools
module (avail in the msft psgallery). That module also tries to import a helper module MipSdkRedist
, also installed from the psgallery. Both modules are the same version, and there aren’t any old lingering version installed either.
If I manually import the module in a powershell session it works just fine, it just fails when the Certify tools tries to load it.
Is the Certify tool running the script in some type of “stricter” way that would be causing the error?
I tried tweaking a few things in the script and eventually got this error, but I don’t remember what I did to get it. I’m sure I could reproduce it if needed though:
2022-09-03 14:33:58.695 -07:00 [ERR] Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MipSdkRedist\22.2.0\MipSdkRedist.psd1'.
Cannot verify the Microsoft .NET Framework version 4.7.0 because it is not included in the list of permitted versions.
Populating RepositorySourceLocation property for module MipSdkRedist.
Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MipSdkRedist\22.2.0\MipSdkRedist.psm1'.
Importing variable 'MipSdkPath
I also tried running powershell as local system to see if it would import and it does.