I am using dynamics 365 online for development and trying to integrate dynamics 365 web api in my existing C# project which uses the organizationService SOAP endpoints.
Before making any changes to the code, i was able to successfully register the plugins.
However, i took help from Web API samples provided by microsoft at https://msdn.microsoft.com/en-us/library/mt742424.aspx and tried to integrate into my existing plugins.
Now, "updating" the plugins through Plugin Registration Tool (SDK 365) gives me the following error :
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load plug-in assembly.
Detail: <OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance">
<ActivityId>5a544e50-bf0c-4915-91c2-dad14b293e11</ActivityId>
<ErrorCode>-2147204719</ErrorCode>
<ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>Unable to load plug-in assembly.</Message>
<Timestamp>2017-06-19T10:35:24.7599515Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>5a544e50-bf0c-4915-91c2-dad14b293e11</ActivityId>
<ErrorCode>-2147204719</ErrorCode>
<ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>Unable to load plug-in assembly.</Message>
<Timestamp>2017-06-19T10:35:24.7599515Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly)
at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.btnregisterClick()
The tool's log mentions :
Preparing Registration
ERROR: Occurred while checking whether the assembly exists
I tried to find the resolution for this error in the community posts, and did not get a clear workaround.
One answer mentions to check that the assembly versions are in fact correct and belong to dynamics 365 SDK.
I tried that too, but still got the same error.
My original package.config :
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Csv" version="1.0.10.0" targetFramework="net45" />
<package id="ilmerge" version="2.14.1208" targetFramework="net45" />
<package id="MSBuild.ILMerge.Task" version="1.0.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
</packages>
After integrating web Api code, package.config :
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Csv" version="1.0.10.0" targetFramework="net45" />
<package id="ilmerge" version="2.14.1208" targetFramework="net45" />
<package id="Microsoft.CrmSdk.WebApi.Samples.HelperCode" version="8.1.0.8" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.1" targetFramework="net45" />
<package id="MSBuild.ILMerge.Task" version="1.0.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="RestSharpSigned" version="105.2.3" targetFramework="net45" requireReinstallation="True" />
</packages>
After trying to updgrade the assembly to match 365 :
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Csv" version="1.0.10.0" targetFramework="net452" />
<package id="ilmerge" version="2.14.1208" targetFramework="net452" />
<package id="Microsoft.CrmSdk.CoreAssemblies" version="8.2.0.2" targetFramework="net452" />
<package id="Microsoft.CrmSdk.WebApi.Samples.HelperCode" version="8.1.0.8" targetFramework="net452" />
<package id="Microsoft.IdentityModel" version="6.1.7600.16394" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.1" targetFramework="net452" />
<package id="MSBuild.ILMerge.Task" version="1.0.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
<package id="RestSharpSigned" version="105.2.3" targetFramework="net452" />
</packages>
But i still get the same error.
Note : I am registering the assembly in Database and using ILMerge to merge the assemblies into single assembly.