Modernization: Could not load file or assembly "Microsoft.Extensions.Caching.Memory" when running ConvertTo-PnPClientSidePage

Created on 12 Jan 2020  路  4Comments  路  Source: pnp/modernization

Category

[X] Bug
[ ] Enhancement

Problem Area

[ ] Page Transformation: Error during the setup/use of the Page Transformation UI solution (did you check our troubleshooting guide?)
[X] Page Transformation: Error during the use of page transformation from PnP PowerShell
[ ] Page Transformation: Error during the use of page transformation from .Net
[ ] Page Transformation: Page is not looking correct after transformation
[ ] Modernization Scanner: something went wrong...

Expected or Desired Behavior

After updating to v3.17.2001 I'm still able to run the command ConvertTo-PnPClientSidePage with the exact same parameters as v3.17.1912.

Observed Behavior

Running this command with v3.17.2001:

ConvertTo-PnPClientSidePage -TargetConnection $target -Connection $source -LogFolder "C:\logs\log-2020-12-1--11-06-12" -Overwrite -PageLayoutMapping $mapping -LogType Console -LogVerbose -PublishingPa
ge -DisablePageComments -Identity 3

throws this exception:

ConvertTo-PnPClientSidePage : Could not load file or assembly 'Microsoft.Extensions.Caching.Memory, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ ConvertTo-PnPClientSidePage -TargetConnection $target -Connection $so ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [ConvertTo-PnPClientSidePage], FileNotFoundException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.ClientSidePages.ConvertToClientSidePage

Get-PnPException returns:

CorrelationId    : aec02a9f-40f8-2000-2e78-d869ec617e48
TimeStampUtc     : 12.01.2020 13:07
Message          : Could not load file or assembly 'Microsoft.Extensions.Caching.Memory, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
Stacktrace       :    at SharePointPnP.Modernization.Framework.Cache.CacheManager..ctor()
                      at SharePointPnP.Modernization.Framework.Cache.CacheManager.<>c.<.cctor>b__78_0()
                      at System.Lazy`1.CreateValue()
                      at System.Lazy`1.LazyInitValue()
                      at SharePointPnP.PowerShell.Commands.ClientSidePages.ConvertToClientSidePage.ExecuteCmdlet()
                      at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()

Steps to Reproduce

PowerShell version:
PnP PowerShell version: 3.17.2001 or 3.17.1912

Running the specified command above throws the exception. I've not changed any other parameter and reverting back to v3.17.1912 resolves the issue.

bug PageTransformationEngine PageTransformationPowerShell

Most helpful comment

@jansenbe @erwinvanhunen Wow, you guys work fast! I can indeed confirm that it is working fine now for a single page. Will run my full script as well which migrates pages from about 130 sites. Thanks for the super-quick turn around!

All 4 comments

Thanks for reporting this @rudfoss , I'll have a look at this. We indeed added this as additional reference, but think it's not correctly packaged in the PS distribution. Could you check if you see the Microsoft.Extensions.Caching.Memory assembly in the directory holding the PS bits?

@rudfoss We most likely found the reason of this issue. We're testing as we speak and if we can confirm it's solved we will release a new version (3.17.2001.1) of PnP PowerShell.

@rudfoss : we can confirm that the 3.17.2001.1 release fixes the problem. Can you retest and see if this works for you as well?

@jansenbe @erwinvanhunen Wow, you guys work fast! I can indeed confirm that it is working fine now for a single page. Will run my full script as well which migrates pages from about 130 sites. Thanks for the super-quick turn around!

Was this page helpful?
0 / 5 - 0 ratings