I'm developing a simple Azure Function project that uses the NuGet package Microsoft.NET.Sdk.Functions (version 1.0.29) to trigger on incoming Azure Storage Queue message, and uses SharePointPnPCoreOnline (version 3.15.1911) to communicate with SharePoint Online.
I seems like the current version of Microsoft.NET.Sdk.Functions does not play well with SharePointPnPCoreOnline, because the former is dependent on Newtonsoft.JSON version 9.0.1, while the latter requires Newtonsoft.JSON >= 11.0.1.
I've tried setting up an Azure Function v1 (which is based on .NET Framework), but this causes my project not even to build:
Error NU1107 Version conflict detected for Newtonsoft.Json. Install/reference Newtonsoft.Json 11.0.1 directly to project FunctionApp5 to resolve this issue.
FunctionApp5 -> SharePointPnPCoreOnline 3.15.1911 -> Newtonsoft.Json (>= 11.0.1)
FunctionApp5 -> Microsoft.NET.Sdk.Functions 1.0.29 -> Newtonsoft.Json (= 9.0.1).
I found a workaround suggesting I could explicitly set the Newtonsoft.JSON version to an older one (in this case 10.0.2), like this:
Doing this still causes my project not even to compile:
Warning NU1608 Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.29 requires Newtonsoft.Json (= 9.0.1) but version Newtonsoft.Json 10.0.2 was resolved.
Another attempt was to base my project on Azure Function v2 (which is based on .NET Core). This causes runtime errors, so I believe SharePointPnPCoreOnline may not be compatible with .NET Core:
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'. Source=OfficeDevPnP.Core StackTrace: at OfficeDevPnP.Core.Diagnostics.Log.InitializeLogger() at OfficeDevPnP.Core.Diagnostics.Log.Debug(String source, String message, Object[] args) at OfficeDevPnP.Core.AuthenticationManager.EnsureToken(String siteUrl, String realm, String appId, String appSecret, String acsHostUrl, String globalEndPointPrefix) at OfficeDevPnP.Core.AuthenticationManager.GetAppOnlyAuthenticatedContext(String siteUrl, String realm, String appId, String appSecret, String acsHostUrl, String globalEndPointPrefix) at OfficeDevPnP.Core.AuthenticationManager.GetAppOnlyAuthenticatedContext(String siteUrl, String appId, String appSecret) at AzureFunction_v2App.Function1.Run(String myQueueItem, ILogger log) in [snip]
Have anyone gotten Microsoft.NET.Sdk.Functions and SharePointPnPCoreOnline to play nicely together, and could perhaps share some insight on how to set up the project?