PnP.Powershell Script

I am attempting to use Connect-PnPOnline (PnP.Powershell Module), which works in a normal Powershell window, and I am getting the below errorr:

Aug 25, 2021 4:45 PM [error] Could not load type ‘Microsoft.Extensions.Logging.Abstractions.Internal.NullScope’ from assembly ‘Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60’.

I’m having trouble sorting out how to avoid what appears to be a dependency issue. Has anyone else encountered this?

Product: PowerShell Universal
Version: 2.2.1
Powershell 5.1 System Environment

This was reported by another user as well. Issue is here: Assembly Conflict with PNP Module in Job · Issue #394 · ironmansoftware/issues · GitHub I haven’t gotten to the bottom of this one yet. I’ll make sure its working for the 2.3.0 release.

Thank you!

Did this issue get resolved in this release?


Yep. That is fixed in 2.3

Pulled everything and re-installed. Still getting that same error. Anything I can clear or update on that system to resolve it?

Can you double check that everything is set to the environment you expect (5.1)?

If you are running within a script, make sure it’s set to run there and not the integrated environment.

I just ran into this same issue, upgraded to 2.3.1, and am still getting the same error with loading the DLL.

[error] Could not load type ‘Microsoft.Extensions.Logging.Abstractions.Internal.NullScope’ from assembly ‘Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60’.

I tried running this in both the 5.1 and my 7.1.4 installed environments also. Both failed the same.

Ack. I just reproduced this as well. I’m looking into it.

Alright. I have a fix for this in 2.4 and will likely merge back into 2.3 so I can put out 2.3.2 this week with this fix. It will also be in tonight’s nightly build.

The problem is there are assembly conflicts between the Pnp module and the assemblies that PowerShell Universal loads. We’ve tried to create a very minimal footprint of assemblies in PSU to avoid these kinds of problems but it’s tricky to avoid all of them. The reason this appeared fixed was that when running Connect-PnpOnline with one set of parameters would not yield this issue while running it with another set of parameters does.

That said, I have not extensively tested the PNP module and we may run into other issues with other cmdlets. It appears that it’s not going to work in the integrated environment due to the assembly conflicts.

1 Like

Thank you much! I’ll grab the nightly as soon as its ready and run some testing. PnP is a big part of my use case so happy to help.

Edit: Current testing is with the system Powershell 5.1

I’ve upgraded to the latest version 2.4.1 and now getting the following error when trying to run Connect-PnpOnline

[error] The type initializer for ‘Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration’ threw an exception.

P.S. This is the newer Install-Module -Name “PnP.PowerShell” module.

I’m currently experiencing a similar problem trying to deploy a Powershell script into Azure Functions.
Locally it works fine, but in Azure it doesn’t.

Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60'

PnP.PowerShell 1.11.0 → Newest Version doesn’t work either, locally all of them work fine
Powershell Version 7.2.6

Do I need to pick an older version of the PnP package or something?
Seems like Microsoft.Extensions.Logging.Abstractions, Version= is quite outdated.

Best Regards