I am developing a plugin that uses ADAL nuget package. My plugin assembly throws an exception when I execute due to missing Microsoft.IdentityModel.Clients.ActiveDirectory dll. The assembly is referencing and merged properly in the merged dll and this is what I see in ILSpy tool:
Here is the list of references in my plugin assembly:
Any ideas how to fix this issue?
After i tried multiple tools to merge my dlls using ILMerge and ILRepack i am facing the same issue. How can i find out Clients.ActiveDirectory dependencies which i think it is the root cause of the error?
This plugin is deployed into a CRM online instance, so I can't add dlls into GAC as we do on-premise.
Here is the exact error message I see from the Plugin Registration tool when I execute my plugin that uses ADAL nuget package:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: **Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=4.4.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencie**s. The system cannot find the file specified.
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ActivityId>00000000-0000-0000-0000-000000000000</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<a:key>CallStack</a:key>
<a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema"> at Microsoft.Dynamics.PerceptionAnalytics.Plugins.ProvisionFloorPlan.<Execute>d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Dynamics.PerceptionAnalytics.Plugins.ProvisionFloorPlan.Execute(IServiceProvider serviceProvider)
at PluginProfiler.Library.PluginAppDomainProxy.ExecuteCore(Stopwatch watch, ProfilerExecutionReport report, Object instance, Object executionParameter)
at PluginProfiler.Library.AppDomainProxy.Execute(ProfilerExecutionConfiguration configuration, ProfilerExecutionReport report)</a:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=4.4.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.</Message>
<Timestamp>2019-01-03T18:30:29.4049324Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>