Merge External Assemblies In Dynamics 365 Online Plugins

In Dynamics 365 Online and all versions of Dynamic CRM, using external dll in plugin is not supported.

When you use external dll in your plugin, an error will be displayed by your plugin.

In this blog we will describe the steps needed to build your plugin and use the external dlls.

 

Step 1)

 

Add your external dll to the solution, like we add DocumentFormat.OpenXml

Right click on your external dll, click on properties and set the Copy Local property to True.

And other dll you are using in your solution like

  • Microsoft.Xrm.Sdk.dll
  • Microsoft.Crm.Sdk.Proxy.dll
  • Microsoft.IdentityModel.dll

Be sure to change these dll properties and set Copy Local to False. If you do not change these settings, ILMerge will include them in your assembly and it will most likely crash your CRM environment.

Please make sure you set Copy Local to true for external dll only.

 

Dynamics 365 Merge External Assemblies

 

step 2)

 

Install MSBuild.ILMerge.Task into your solution through Nuget.

 

Dynamics CRM Online Merge External Assemblies

 

step 3)

 

Build you solution: when you build your solution, please note it will take more time than your normal solution building because it must merge external dll with your plugin dll.

Register the plugin in CRM and enjoy the external dll.

That’s it for today, I hope it will help!

1 thought on “Merge External Assemblies In Dynamics 365 Online Plugins”

Leave a Reply

Your email address will not be published. Required fields are marked *