PnP-Sites-Core
PnP-Sites-Core copied to clipboard
Does not work with AngleSharp 0.12.1
Hi guys,
I have a ClientSidePages section that fails to work after upgrade of NuGet packages. Error is:
03/03 - ClientSidePages Failed to apply template: Could not load type 'AngleSharp.Parser.Html.HtmlParserOptions' from assembly 'AngleSharp, Version=0.12.1.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea'.
Anything I have to do or is it you ?
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
We use version 0.9.9 in core...you an only upgrade to a high version of AngleSharp if either we handle it for core as well or if you define the needed assembly redirects in the config files of your project
I
am also having a related issue to this.
I am running SharePointPnPCoreOnline 3.16.1912 With default dependant packages in this case AngleSharp 0.9.9
If I add the ClientSidePages section to my template I get an error saying that it cannot load AngleSharp 0.12.1.0
So, should I be using AngleSharp 0.12.1.0 or 0.9.9?
If I upgrade to 0.12.1.0 from 0.9.9 I get the same error that TOPDHI does.
What am I missing here?
See error stack trace below
01/08 - Initializing engine
02/08 - Features
03/08 - Application Lifecycle Management
04/08 - ClientSidePages
System.IO.FileLoadException: Could not load file or assembly 'AngleSharp, Version=0.12.1.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'AngleSharp, Version=0.12.1.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' ---> System.IO.FileLoadException: Could not load file or assembly 'AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea'
=== Pre-bind state information ===
LOG: DisplayName = AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea
(Fully-specified)
LOG: Appbase = file:///C:/Source/....Provisioning.Console/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : OfficeDevPnP.Core, Version=3.16.1912.0, Culture=neutral, PublicKeyToken=5e633289e95c321a.
===
Pete
Pete,
I had the same issue after updating and than going back to the previous version. It updates some config entries and some dependencies. There will be better solutions i think but for me this worked:
-> Remove the entry from your App.config file -> Remove the version folders from your projects packages location (Optional i think) -> Uninstall pnpcoreonline (nuget) -> Uninstall Anglesharp(nuget)
-> install pnpcoreonline
Kind regards Simon
@PaoloPia @jansenbe is the version 0.9.9 still one used by PnP Sites Core? I inherited a project that uses 0.13.0 and throws an error asking for 0.9.9 - I am just not sure if it is safe to donwgrade it (this is for SP2019)
It looks like there was some major surgery carried out by the AngleSharp guys back in 2016, they decided to rename AngleSharp.Parser.Html. to AngleSharp.Html.Parser and various other breaking changes.
So it's highly unlikely you'll be able to use a more recent version in your project until PnP Sites Core is updated.
@pvranich Did you find any solution , i am having same issue
As I said above, it was renamed from AngleSharp.Parser.Html to AngleSharp.Html.Parser - if you want to use it with AngleSharp 14 you'll need to make sure you are using the latest version from nuget, it was updated a few weeks ago.
@pvranich Did you find any solution , i am having same issue
@netclectic If i am using latest pnp package than "modern team site create" code is not working
Thats why i downgrade pnp version , but in lower version i have Angle sharp error.
This is deadlock kind of thing for me
Hi @DesireTusharG,
I did upgrade my version but as you have found you also have to update the modern team site creation code.
Note: I was creating a unified group but the principal is the same.
This will require the relevant app registration setup in Azure AD. Here is a link for the different options on how to do that. Granting access via Azure AD App-Only
Here is the code I used once I got the app registration configured. This will give you a MS Graph authentication token.
protected virtual async Task<string> AquireAccessToken()
{
IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(<App registration app\client id>)
.WithTenantId(<your tenant id>)
.WithCertificate(<a valid certifacte to authenticate to the app registration>)
.Build();
AcquireTokenForClientParameterBuilder clientTokenBuilder = confidentialClientApplication.AcquireTokenForClient(new string[] { "https://graph.microsoft.com/.default" });
AuthenticationResult authenticationResult = await clientTokenBuilder.ExecuteAsync();
return authenticationResult.AccessToken;
}
Here is my code for creating the modern team site
string token = await AquireAccessToken();
if (!await Exists(Name))
{
UnifiedGroupsUtility.CreateUnifiedGroup(
DisplayName,
Description,
Name,
token,
OwnersArray,
MembersArray,
true,
false
);
}
In this case i have different challenge that i am facing, i am working on cross tenant. where i don't have access of azure ad