{"id":12142,"date":"2018-06-29T18:04:08","date_gmt":"2018-06-29T12:34:08","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=12142"},"modified":"2022-06-14T14:32:09","modified_gmt":"2022-06-14T09:02:09","slug":"automate-ilmerge-for-workflowsplugins-to-merge-multiple-assemblies-into-one-in-dynamics-365","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2018\/06\/automate-ilmerge-for-workflowsplugins-to-merge-multiple-assemblies-into-one-in-dynamics-365\/","title":{"rendered":"Automate ILMerge for Workflows\/Plugins to Merge Multiple Assemblies into One in Dynamics 365"},"content":{"rendered":"<h2><strong>Introduction: <\/strong><\/h2>\n<p style=\"text-align: justify;\">Recently we got a business requirement where we need to merge two assemblies into single exe i.e. one .net assembly and another assembly which would serialize and deserialize, so we used Newtonsoft.Json.dll for it. To merge Newtonsoft.Json.dll with .net dll in single exe it is recommended to use ILMerge.<\/p>\n<p style=\"text-align: justify;\">ILMerge\u00a0is a tool that can combine multiple DLLs into a single exe. For this every time, we need to manually merge the assembly using ILMerge UI as shown below.<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-12143\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-365.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"824\" height=\"771\" \/><\/p>\n<p>This blog explains the basics of using ILMerge to create a single Workflow\/Plugin DLL without using ILMerge tool externally every time.<\/p>\n<p><strong>Step 1:<\/strong> Add ILMerge.MSBuild.Task using Nuget to your Visual Studio project:<\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt 0in;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292e; background: white;\">Navigate to Visual Studio Project\u00a0\u2192 Tools\u00a0\u2192 Library Package Manager\u00a0\u2192 Package Manager Console<\/span><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt 0in;\"><img decoding=\"async\" class=\"aligncenter wp-image-12144\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3651.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"819\" height=\"281\" \/><\/p>\n<p><strong>Step 2:<\/strong> Use command \u201c<strong>Install-Package ILMerge.MSBuild.Task<\/strong>\u201d and paste in package manager console.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-12145\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3652.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"817\" height=\"169\" \/><\/p>\n<p><strong>Step 3:<\/strong> Also need to install the ILMerge Package using command \u201c<strong>Install-Package ilmerge<\/strong>\u201d in the package manager console<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-12146\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3653.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"820\" height=\"169\" \/><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt; text-align: justify;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292e; background: white;\"><strong>Step 4:<\/strong>\u00a0Build your project. After successful build one new folder is created with the name <strong>ILMerge<\/strong>. The merged assembly will be stored in an ILMerge folder under the project output. (Need to merge Crm.Workflow.dll and Newtonsoft.Json.dll)<\/span><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt 0in;\"><img decoding=\"async\" class=\"aligncenter wp-image-12147\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3654.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"825\" height=\"203\" \/><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt; text-align: justify;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292e; background: white;\"><strong>Step 5:<\/strong>\u00a0Merge Output is present in the ILMerge folder (Under ILMerge Folder Crm.Workflow.dll is merged output).The merged dll contains the component of both the dlls (i.e. Newtonsoft.Json.dll, Crm.Workflow.dll). Now you have to use this dll (i.e. Crm.Workflow.dll) for further processes to reflect the changes in your CRM.<\/span><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt 0in;\"><img decoding=\"async\" class=\"aligncenter wp-image-12148\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3655.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"819\" height=\"160\" \/><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt; text-align: justify;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292e; background: white;\"><strong>Step 6:<\/strong> By default, all references with\u00a0Copy Local\u00a0equals\u00a0true\u00a0are merged with your project output. To avoid merging of CRM SDK DLLs and Microsoft.IdentityModel.DLL into our DLL we need to select the three files and set the property \u201cCopy Local\u201d to false.<\/span><\/p>\n<p style=\"background: white; margin: 0in 0in 22.5pt 0in;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-12149\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/06\/Merge-Multiple-Assemblies-into-One-in-Dynamics-3656.png\" alt=\"Merge Multiple Assemblies into One in Dynamics 365\" width=\"317\" height=\"572\" \/><\/p>\n<h2><strong>Conclusion:<\/strong><\/h2>\n<p style=\"text-align: justify;\">Merging of multiple dlls using external tool is time-consuming and somewhat annoying. So simply type the commands <strong>Install-Package ILMerge.MSBuild.Task, Install-Package ilmerge<\/strong> in package manager console of your project and after successful installation, rebuild your project and you will get newly merged dll\u00a0for further processing to reflect changes in your\u00a0CRM.<\/p>\n<p><a href=\"http:\/\/maplytics.com\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-11613\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2018\/04\/Generate-Your-Own-New-Leads-Now-Within-Dynamics-365-CRM-with-Maplytics-11.png\" alt=\"Map Dynamics CRM\" width=\"824\" height=\"206\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Recently we got a business requirement where we need to merge two assemblies into single exe i.e. one .net assembly and another assembly which would serialize and deserialize, so we used Newtonsoft.Json.dll for it. To merge Newtonsoft.Json.dll with .net dll in single exe it is recommended to use ILMerge. ILMerge\u00a0is a tool that can\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2018\/06\/automate-ilmerge-for-workflowsplugins-to-merge-multiple-assemblies-into-one-in-dynamics-365\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":12150,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,18,19,42],"tags":[1087],"class_list":["post-12142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-dynamics-365-v9-2","category-dynamics-crm","category-plugin","tag-merge-multiple-assemblies"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/12142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=12142"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/12142\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/12150"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=12142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=12142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=12142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}