Forum Discussion
Anthony Conrad
Jan 16, 2018Copper Contributor
PnP Provisioning Engine Extensibility Handlers: FileLoadException
I'm trying to use the PowerShell cmdlets and add my own extensibility handlers when using the Get-PnPProvisioningTemplate cmdlet.
I use the following PowerShell commands in the same directory a...
Anthony Conrad
Jan 17, 2018Copper Contributor
Ok. I have insured that I have the following environment and used the following cmdlets yet still receive the same error. Perhaps it is time for me to publish a bug report?
PowerShell Module
Name: SharePointPnPPowerShellOnline Version: 2.18.1709.0
Nuget Package
<package id="SharePointPnPCoreOnline" version="2.18.1709.0" targetFramework="net452" />
Command
$handler1 = New-PnPExtensbilityHandlerObject -Assembly "MyProvider.dll" -Type MyProvider.ListsProvider Get-PnPProvisioningTemplate -Force -Schema V201705 -ExtensibilityHandlers $handler1 -Handlers ExtensibilityProviders
Error Message
Get-PnPProvisioningTemplate : There was an exception invoking the custom extensibility provider. Assembly: MyProvider.dll, Type: MyProvider.ListsProvider. Exception System.IO.FileLoadException: Could not load file or assembly 'MyProvider.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: 'MyProvider.dll'
at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
at System.Reflection.RuntimeAssembly.CreateAssemblyName(String assemblyString, Boolean forIntrospection, RuntimeAssembly& assemblyFromResolveEvent)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence
securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at OfficeDevPnP.Core.Framework.Provisioning.Extensibility.ExtensibilityManager.GetProviderInstance(ExtensibilityHandler handler)
at OfficeDevPnP.Core.Framework.Provisioning.Extensibility.ExtensibilityManager.ExecuteExtensibilityExtractionCallOut(ClientContext ctx, ExtensibilityHandler handler, ProvisioningTemplate template,
ProvisioningTemplateCreationInformation creationInformation, PnPMonitoredScope scope)
At line:1 char:1
Deleted
Jul 11, 2018Hi Anthony Conrad,
I've been able to avoid the error.
Here the correct commands:
Add-Type -Path "C:...\MyProvider.dll"
$handler = New-PnPExtensibilityHandlerObject -Assembly "MyProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" -type "MyProvider.ListsProvider"
Get-PnPProvisioningTemplate -Out test.xml -ExtensibilityHandlers $handler