Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider.GetTemplate() returns Unable to load one or more of the requested types. WHEN together with Graph SDK 5 #1042

Open
mmsharepoint opened this issue Jul 25, 2024 · 5 comments

Comments

@mmsharepoint
Copy link

Vers: 1.16.0 \ 1.16.1-nightly
Steps to reproduce:

  • Create console app
  • Add Microsoft.Graph(.Beta)
  • Add PnP.Framework
  • Add simple PnP template (to project root for simplicity)
  • Add 3 lines of code
    string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    XMLTemplateProvider provider1 = new XMLFileSystemTemplateProvider(path, "");
    var template1 = provider1.GetTemplate("TemplateBasic.xml");
  • Fail at line 3 with

Could not load type 'Microsoft.Graph.HttpProvider' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not load type 'Microsoft.Graph.ICollectionPage`1' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

@Gregorly
Copy link

Gregorly commented Jul 25, 2024

Just upgraded from .net 6 to 8 and updated MS Graph SDK from v3.33.0 and Pnp Framework version 1.16.0 to the latest MS Graph SDK v5.56.0 (Pnp version remained at v1.16.0) and we are encountering almost the exact same error message while either saving XML file using the below two lines,

XMLTemplateProvider provider = new XMLFileSystemTemplateProvider(directoryPath, "");
provider.SaveAs(template, "template.xml");

OR if we do not save the xml file to get around the initial error, while applying the template.

web.ApplyProvisioningTemplate(template, ptai);

Error below:

Unable to load one or more of the requested types.
Could not load type 'Microsoft.Graph.HttpProvider' from assembly 'Microsoft.Graph.Core, Version=3.1.12.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupOwnersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.User' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceSubscriptionsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupOwnersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.User' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IUserDeltaCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

@ved-leachim
Copy link

I encounter the same errors like mmsharepoint. I am using .NET 8 / pnp.Framework 1.16.0 / Microsoft.Graph 5.56.0 / Microsoft.Graph.Core 3.1.15.

Failing on second line:

var provider = new XMLSharePointTemplateProvider(csomContext,
"https://contoso.sharepoint.com/sites/site", "Templates");
var template = provider.GetTemplate("template.xml");

Unable to load one or more of the requested types.
Could not load type 'Microsoft.Graph.HttpProvider' from assembly 'Microsoft.Graph.Core, Version=3.1.15.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupOwnersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.User' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceSubscriptionsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Subscription' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceGroupsCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupMembersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGroupOwnersCollectionWithReferencesPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.User' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.Graph.IUserDeltaCollectionPage' from assembly 'Microsoft.Graph, Version=5.56.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

@mmsharepoint Did you find a workaround?

@MathieuMarchant
Copy link

Same issue here, was anybody already able to resolve this?

@brnowakowski
Copy link

Any progress on this?

@dnc-nl
Copy link

dnc-nl commented Nov 3, 2024

same here, any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants