I'm trying to solve problem of two projects that try to use same package (Microsoft.Graph
) but each uses different version of it. (See diagram below).Orchestrator is an Azure Function that references two Azure Functions from separate projects (Foo
and Bar
).Foo references PnP.Framework
that references old version of Microsoft.Graph
(3.33.0
) and as it is, was working fine until I have added Bar. Bar references newest version of Microsoft.Graph
(5.11.0
).
After adding Bar
, Foo
started to throw following exception:
(...)Result: Function 'FooFunction', Invocation id 'd06cc6ff-1805-4886-808d-f2595db3a30e': An exception was thrown by the invocation.Exception: System.AggregateException: One or more errors occurred. (Unable to load one or more of the requested types.Could not load type 'Microsoft.Graph.HttpProvider' from assembly 'Microsoft.Graph.Core, Version=3.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Could not load type 'Microsoft.Graph.Group' from assembly 'Microsoft.Graph, Version=5.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Could not load type ... etc etc(...)
This shows that Foo
started to look for 3.33
types in 5.11
version of Microsoft.Graph
and sure enough, in the bin folder you will only find Microsoft.Graph.dll
with version 5.11
.
Right now the Orchestrator is calling the Functions in following way
await context.CallActivityAsync(nameof(FooFunction), coolData);await context.CallActivityAsync(nameof(BarFunction), coolData);
Originally the FooFunction
and BarFunction
were placed in the same project. I separated them in hope of possibly isolating dll's to no avail.
I've seen some posts like thisor thisand this.
But all of them are workarounds revolving around either dropping or downgrading one of the dependencies or even ...
My current workaround is to use a completely different function app for SharePointPnPCoreOnline which is based on .NET framework while all of the Graph and other functionality lives in a different function app based on .NET Core. Any communication between the function apps is done through queue messages. Not ideal but works for the time being.
Yeah ... no.
Microsoft reference contains some information about similar scenario but I can't find applicable solution to my case.