-
Notifications
You must be signed in to change notification settings - Fork 659
[Remove-PnPFolder] throws error "Could not load file or assembly" #2123
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
It is related to -Scope CurrentUser. I get the same error when I update the modules. Installing the msi packages to my local profile works, but is less than optimal. I receive the error running any PnP cmdlet on versions past 3.9.1905.3 related to NewtonSoft.Json.dll. |
I was able to locate the issue in the master branch code. In the PnPCmdlet.cs file on line 136, the code used to dynamically load the NewtonSoft.Json.dll is not suited to work with UNC paths, so the issue here is not a user profile in general, but may arise when the userprofile is redirected to a file server as the code does not correctly build the path when loaded from a UNC file path. I was not able to find the issue in the dev branch though, so I am hoping this is going to make it to the next release. Workaround 1: Workaround 2: private string AssemblyDirectory
{
get
{
var location = Assembly.GetExecutingAssembly().Location;
var escapedLocation = Uri.UnescapeDataString(location);
return Path.GetDirectoryName(escapedLocation);
}
} |
Any update on this? I am getting the below error. I think it is the "My Documents" folder is not enclosed in quote somehow.
|
This will be fixed in the February 2020 release of PnP PowerShell which is scheduled for Monday January 10, 2020. Closing this issue. Feel free to reopen in case the issue still occurs after the February 2020 version has been released. |
@PowershellNinja I think this is causing #2521, which would seem to prevent PnP PowerShell from being used in an Azure Function. |
Yes, I'm going to revert it back and to find another solution. Thanks. |
Submitted PR #2566 in which this should be fixed |
Reporting an Issue
Getting a 'Could not load file or assembly' error after updating to latest release.
Expected behavior
Folder is removed; no error thrown; the assembly is loaded from the UNC path where it resides (e.g. \\path\to\home\WindowsPowerShell\...\3.10.1906.0\Newtonsoft.Json.dll)
Actual behavior
Running
Remove-PnPFolder
results inSteps to reproduce behavior
Connect-PnPOnline
Remove-PnPFolder
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.10.1906.0
How did you install the PnP-PowerShell Cmdlets?
The text was updated successfully, but these errors were encountered: