[Solved] Could not load file or assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. In Azure Function and Dynamics 365 Integration
While working with Azure Function to connect Dynamics 365 you might face below error.
Could not load file or assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
The Solution:
This error comes because of Version mismatch in Assemblies of Microsoft Core Assemblies and Project .NET Framework.
Follow below points:
Step:1
Use .NET Framework 4.6.1 in Function App in Visual Studio
Step:2
Add References of Microsoft.CrmSdk.CoreAssemblies version 8.2.0.1 and Microsoft.CrmSdk.XrmTooling.CoreAssembly 8.2.0.1
Now publish your Function App it will work.
Hope this helps