Replies: 17 comments 7 replies
-
This is an issue with the VSCode PowerShell Extension and PnP.PowerShell. Last update was Don't count on this ever being fixed Either use 5.1 or the Console |
Beta Was this translation helpful? Give feedback.
-
In my example, I am executing it in the console. Also, the way I read the other thread is to use PowerShell Core (AKA 7) which I am also doing. This worked for months and only recently stated failing |
Beta Was this translation helpful? Give feedback.
-
Any ideas? |
Beta Was this translation helpful? Give feedback.
-
The only other thing I've come across with the EXO module was that you had to have basic Auth enabled, but I don't think that would effect what you're doing in this instance. Could you sanitise the script and I can try to replicate on my tenant |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Am transferring this to discussions as this is not an issue with PnP PowerShell command executions. |
Beta Was this translation helpful? Give feedback.
-
I can use PnP 1.7 with ExchangeOnlineManagement 2.0.5 because they use the same Microsoft.Identity.Client.dll. Any Ideas on how to use 1.10 without DLL conflict? |
Beta Was this translation helpful? Give feedback.
-
I can confirm @pttbr comment I have the pretty same config except that i'm using the new 2.0.6-Preview6 Exchange module. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately ms me it doesn't if you go back and forth between them
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: PowerBugi ***@***.***>
Sent: Saturday, June 18, 2022 1:37:51 AM
To: pnp/powershell ***@***.***>
Cc: svermaak ***@***.***>; Author ***@***.***>
Subject: Re: [pnp/powershell] [BUG] Using PnP with ExchangeOnlineManagement - Could not load file or assembly 'Microsoft.Identity.Client, Version=4.36.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Could not find or load a specific file. (0x80131621) (...
I can confirm @pttbr<https://github.com/pttbr> comment
I have the pretty same config except that i'm using the new 2.0.6-Preview6 Exchange module.
If i connect Exchange before PnP it work.
Otherwise it fail (with the same error in the title of the issue).
—
Reply to this email directly, view it on GitHub<#1814 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AC5RDEBM3HCT5KWMP5BUVWTVPSLU7ANCNFSM5U2QZJPA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Solution, mine. Its true that if you connect to multiple things to perform your work, you will run into issues with DLL versions being incorrect for one but not another. What you have to do is split it up. I have a PS7 automation script that provisions SPO modern sites. It creates sites, renames them, applies site templates, hides them from the global address book, etc. All these pieces of work to create one given site requires multiple connects. One other thing, all these connections are required to be modern auth... no secure string password saves on local. You cannot have all these connections in a single inline script. As we all know now. So my [main] script starts off using Connect-PnpOnline: Connect-PnPOnline -Url $onlineSiteDirectoryHostUrl -ClientId (ConvertFrom-SecureString $spClientID -AsPlainText) -ClientSecret (ConvertFrom-SecureString $spClientSecret -AsPlainText) -WarningAction Ignore Eventually it gets to a point where is has to create a default SPO Modern site. I had to use Graph API for this, and this is it's own dedicated PS7 script.
This code clip invokes an external script, and blocks on it, waiting for it to finish. Here is the code for that secondary script. I connects to Graph using MSAL, creates a new site group, and then issues a web request to hide that new site group from the GAL (Sorry for the whack formatting, just ignore it. Code clip ends with "return 200"): Import-Module MSAL.PS ############################################################### Create the Site Group, and then update it's Outlook settings############################################################### logInfo("Creating new project site group: $ProjectID ") $params = @{ New-MgGroup -BodyParameter $params Start-Sleep 30 Hide from Outlook$grp = Get-MgGroup -Filter "MailNickName eq '$ProjectID'" Start-Sleep 10 build a REST PATCH call and invoke - This is to HIDE the Group from within Outlook!!!$headers = New-Object 'System.Collections.Generic.Dictionary[String,String]' $body = @" $apiUri = "https://graph.microsoft.com/v1.0/groups/" + $grp.Id $attempts = 1 logInfo("Before Invoke-WebRequest to hide group from GAL: " + $apiUri) while ($attempts -le 6)
} Geo-SendEmail -To "sboltman@abc.com" -Subject "HidingGroupFromOutlook FAILED in Helper-Graph-CreateSiteGroup.ps1" -Body ("HidingGroupFromOutlook FAILED in Helper-Graph-CreateSiteGroup.ps1 -> $apiUri -> Attempt: $attempts -> " + $_.Exception.Message) return 200 This main script of mine calls out to three "helper/secondary" scripts like the clip from the one above. By segregating out these various APIs into their own callable scripts, can you avoid this maddening DLL version conflicts. I always hope for finding real function code example when I research issues. I hope this one hopes others. |
Beta Was this translation helpful? Give feedback.
-
I discovered what seems to be the cause of the problem. the DLL : Microsoft.Identity.Client.dll of the other modules. Basically :
Example : I run PowerShell and I run the It is not possible to "unload" a DLL, so once the old DLL is loaded, it is too late. On the other hand, if I run PowerShell and run the By the way, you can check which DLL is loaded after each command to verify this theory, with this command : Also, I had fun loading the ExchangeOnline module DLL myself with this command in new PowerShell session :
And to run in the order So the question is... Is it possible to avoid this problem without having to check the dll version and/or having to load this or that module before another one... ? |
Beta Was this translation helpful? Give feedback.
-
Does the community know of a compatible version of PNP with 3.1.0 ExchangeOnlineManagement? We want to use EXOv3 with PNP DLL. |
Beta Was this translation helpful? Give feedback.
-
This is just terrible design throughout the entire framework. Why would you write multiple modules requiring multiple versions of a library? Where is the centralization? And to simply say this version of the DLL can do this and the other can't is just a crutch. I have been battling this for some time and its beyond frustrating to say the least. If you have that many issues within a framework, why no stop dragging dead bodies forward and fix the root issue? |
Beta Was this translation helpful? Give feedback.
-
For everyone still looking, I might have a solution for you: |
Beta Was this translation helpful? Give feedback.
-
The issue with colliding assemblies should now be fixed! |
Beta Was this translation helpful? Give feedback.
-
Reporting an Issue or Missing Feature
Using PnP with ExchangeOnlineManagement - Could not load file or assembly 'Microsoft.Identity.Client, Version=4.36.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Could not find or load a specific file. (0x80131621)
Expected behavior
Use PnP PowerShell successfully with ExchangeOnlineManagement
Actual behavior
Steps to reproduce behavior
See screenshot
What is the version of the Cmdlet module you are running?
Latest
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions