Friday, February 9, 2018

CRM cannot find the plugin assembly or one of its dependencies”
OR
 How to use IL Merge with CRM Online ?
OR
 How to merge DLLs ?



Hi ,

D365 allows to deploy a single dll into the platform. Hence when required to use reference dll


CRM cannot find the plugin assembly or one of its dependencies  is a common scenario.


With Dynamics 365 round the corner, Situation of using  I L Merge is increasing every day.


While working on a plugin we encountered a situation where we had to use a reference dll.


CRM cannot find the plugin assembly or one of its dependencies.

To Resolve this We have used the Microsoft Tool ILmerge

There can be two methods to resolve the error

1) Copy the Dll which needs to be merged into the Ilmerge folder with references such as Microsoft.Xrm.Sdk.Proxy , Microsoft.Crm.Sdk , Strong Key File Which is used to sign the assemblies.

2) Also copy and paste mscorsn.dll from “C:\Windows\Microsoft.NET\Framework64\v4.0.30319” on your PC.

Remember Key must be of .snk type. (Dll Can be merged using .pfx but may  not work with CRM)




Type The Following Command to Merge the dll into cmd.

C:\Program Files (x86)\Microsoft\ILMerge>ilmerge /keyfile:Ilmerge.snk  /target:library /copyattrs /targetplatform:v4,"C:\Windows\Microsoft.NET\Framework64\v4.0.30319" /out:CompletePlugin.dll Plug_Ilmerge.dll Plug_Data.dll


Definition  :
CompletePlugin.dll – is a merged Dll
Plug_Ilmerge.dll  -- is a1st  plugin which is merged.
Plug_Data.dll – is a 2nd plugin which is to be merged.




Other Way is using Nugget Packages in VS 2013 onwards using IL which I would write off some other day.


1 comment:

  1. Aditionaaly if you are using Developer Tool Kit. You can automate the process by adding the following in.csproj



    $(SolutionName).Plugin.dll
    $(SolutionName).Common.dll
    $(SolutionDir)Plugin\$(OutDir)$(PluginDLLName)
    $(SolutionDir)$(SolutionName).Common\$(OutDir)$(CommonDLLName)
    "G:\CRM\GItCde\CRMBranch\GITCRMCode\packages\ILMerge.3.0.41\tools\net452\ILMerge.exe"
    $(Ilmerge) /keyfile:$(SolutionDir)amsIndia.snk /target:library /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2" /out:$(PluginDLLName) $(PluginDLL) $(CommonDLL)

    ReplyDelete