PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

[BUG] Running PnP-Powershell in Azure, Could not load file or assembly 'System.Threading.Tasks.Extensions

Open NicolasKheirallah opened this issue 5 years ago • 8 comments

If you have a question and are not reporting a bug, please go to:

https://github.com/pnp/pnp-powershell/discussions

Reporting an Issue or Missing Feature

Bug in newest PnP

Expected behavior

Tested a older version (3.17) and it worked as it should, 3.25 doesn't

Actual behavior

2020-09-07T12:33:32.238 [Error] A ScriptHost error has occurred
2020-09-07T12:33:32.238 [Error] Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
2020-09-07T12:33:32.300 [Error,ApplyPnPProvisioningTemplate] Exception while executing function: Functions.ApplyPnPProvisioningTemplate. System.Management.Automation: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. mscorlib: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
2020-09-07T12:33:32.347 [Error,ApplyPnPProvisioningTemplate] Exception while executing function: Functions.ApplyPnPProvisioningTemplate
2020-09-07T12:33:32.347 [Error,ApplyPnPProvisioningTemplate] Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
2020-09-07T12:33:32.378 [Error,ApplyPnPProvisioningTemplate] Function completed (Failure, Id=775374b4-d4c5-428b-8227-1ef27c02ddf7, Duration=5464ms)
2020-09-07T12:33:32.425 [Error,ApplyPnPProvisioningTemplate] Executed 'Functions.ApplyPnPProvisioningTemplate' (Failed, Id=775374b4-d4c5-428b-8227-1ef27c02ddf7)
2020-09-07T12:33:32.425 [Error,ApplyPnPProvisioningTemplate] Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
2020-09-07T12:33:32.425 [Error,ApplyPnPProvisioningTemplate] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '775374b4-d4c5-428b-8227-1ef27c02ddf7'
2020-09-07T12:33:32.425 [Error,ApplyPnPProvisioningTemplate] Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
2020-09-07T12:35:25  No new trace in the past 1 min(s).

Steps to reproduce behavior

1.Create an azure function for powershell 2.Create a folder called module under your function using kudu: "D:\home\site\wwwroot\ApplyPnPProvisioningTemplate\modules" 3. Test your Azure Function and you will get the error above.

Which version of the PnP-PowerShell Cmdlets are you ?

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [ ] PnP PowerShell for SharePoint 2019
  • [X ] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name sharepointpnppowershell* -ListAvailable)

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [X ] Installed through the PowerShell Gallery with Install-Module
  • [X ] Other means

NicolasKheirallah avatar Sep 07 '20 12:09 NicolasKheirallah

Same behavior here too

SnappyFPV avatar Sep 24 '20 13:09 SnappyFPV

Same behavior here too, any updates on this?

hittle08 avatar Sep 28 '20 16:09 hittle08

I see the same problem. 3.22.2006.0 worked for me but not 3.25.2009.1

Leif-Frederiksen avatar Sep 30 '20 08:09 Leif-Frederiksen

Who at microsoft do I need to contact about this? I have a premium subscription with them and I keep getting bounced around between the SharePoint team, Azure Team, and Office 365 team.

hittle08 avatar Sep 30 '20 20:09 hittle08

PnP is a community project,I recommend you downgrade to 3.22.2006 for now

NicolasKheirallah avatar Oct 01 '20 10:10 NicolasKheirallah

At 3.22.2006 my provisioning template is not set correctly. It works locally at 3.24 and 23.25 - but these versions won't go on Azure. Does anybody know if there's going to be an update soon?

veniti avatar Oct 08 '20 09:10 veniti

Last one I was able to run in Azure is: 3.23.2007.0

Rob3r70 avatar Oct 17 '20 17:10 Rob3r70

I just tried this for the first time today and got the same error...I am running 3.26.2010.0. Is there any fix other than running a lower version of PnP?

MRoot21 avatar Nov 10 '20 20:11 MRoot21