Monthly Archives: December 2018

Newtonsoft Version conflicts with Azure Function & PnP-Sites-Core

Compilation Warnings

Warning NU1608 Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.24 requires Newtonsoft.Json (= 9.0.1) but version Newtonsoft.Json 10.0.3 was resolved.

The Cause:

The Function App references a Business Layer project, which references the OfficePnP.Core NuGet package, which Newtonesoft.Json version 10.0.3

The Function App reference the Microsoft.NET.Sdk.Functions (version 10.0.24), which unfortunately references the Newtonesoft.Json version 9.0.1

The project builds with the NU1608 Warning, and causes the following code to throw an error:

XMLTemplateProvider provider = new XMLFileSystemTemplateProvider(templateFilePath, string.Empty);
ProvisioningTemplate template = provider.GetTemplate(templateFileName);

The “Fix”:

I have manually updated the Function Apps .CSProj file to include the following reference:

<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />

This causes the Dependency and NuGet folders to show a warning triangle, however the project builds and the PnP ProvisioningTemplate loads OK.

More Information:

I also attempted a downgrade of the Business Layer project SharePointPnPCoreOnline NuGet reference to version: 2.24.1803 (this references Newtonesoft.Json version 9.0.1), however the following code failed to work:

ProvisioningTemplate template = provider.GetTemplate(templateFileName);

MSBuild task for Azure Functions

Access denied – refresh all published content types on next update

Working with the Content Type Hub and publish (syndicate) content types to other site collections; have you received an Access Denied message when selecting the “Refresh all published content types on next update”?

Well it turns out that you are denied access because the DenyAddAndCustomizePages is set to TRUE for that site collection.

To grant access to the “Refresh all published content types on next update” functionality you need to set the “Deny Add and Customize Pages” fag to false. This can be done simply, by running the following PowerShell:

Set-SPOsite -DenyAddAndCustomizePages 0;