web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Temmy Raharjo Blog / Dynamic Crm Merge Assemblies

Dynamic Crm Merge Assemblies

Temmy Wahyu Raharjo Profile Picture Temmy Wahyu Raharjo 2,916

Now I want to share how to merge multiple assemblies in Dynamic CRM Environment. We used ILRepack as our merge tool because of the result is smaller compare to ILMerge.

For this tutorial, we will embed the command for merging in .csproj, so everytime we build our project. The result in the bin folder already merged.

  1. In your current project, right click and add nuget package > search ILRepack and installed it. Or you can open Nuget Package Manager and install it using “Install-Package ILRepack -Version 2.0.15”ilrepack-installation-nuget
  2. After finished download and setup your nuget, save all of your project. Then open your .csproj with other editor and put the command for mergingcsproj-ilrepack

<Target Name=”AfterBuild”>
<ItemGroup>
<InputAssemblies Include=”$(TargetPath)” />
<!– Framework –>
<InputAssemblies Include=”$(TargetDir)Niam.XRM.Framework.dll” />
<InputAssemblies Include=”$(TargetDir)Plugins1.dll” />
</ItemGroup>
<ItemGroup>
<KeyFile Include=”$(ProjectDir)key.snk” />
</ItemGroup>
<Exec Command=”$(ILRepack) /keyfile:@(KeyFile) /parallel /out:$(TargetPath) /lib:$(TargetDir) @(InputAssemblies -> ‘%(Identity)’, ‘ ‘)” />
</Target>

You can put all the needed assemblies in that configuration and don’t forget to put the snk file also. For this example I put key.snk.

When you build your project, you will notice in your output will have this result:

output-result

For checking, you can open your dll using ILSpy to check is it already merged or not:

ilspy-result


This was originally posted here.

Comments

*This post is locked for comments