Merging .Net assemblies for Tungsten TotalAgility
In general, external .Net assemblies are used to implement additional customisation in the applications developed using Tungsten TotalAgility . However, there are challenges in Tungsten TotalAgility with uploading references of the .Net assemblies to Tungsten TotalAgility store. The challenge involves copying references of a .net assembly in the bin directory of TotalAgility, CoreWorker Service folders, etc.
For instance, “acmo.acore.businessrules.dll” is a reference in acmo.apay.tungsten .Net project. When the “acmo.apay.tungsten.dll” is uploaded to Tungsten TotalAgility .Net assemblies store, “acmo.acore.businessrules.dll” must be copied to bin directory of KTA manually.
The problem of copying, maintaining the references can be solved and the answer is “ILMerge“!.
ILMerge is a utility that merges multiple .NET assemblies into a single assembly. It is freely available for use and is available as a NuGet package. The merged single assembly can be uploaded into Tungsten TotalAgility store and we need not to worry about the reference dll’s
Firstly, ILMerge must be included in the .Net project and the simplest way is import as a NuGet package. Using following commands to install the pacakge to your project.
Once the package is installed successfully, right-click the reference dll and select “Properties” as shown below.
Set “Copy Local” property value to “true”. This will ensure that the reference dll is copied to the output directory. By default ILMerge considers only dll’s part of the output directory.
If there are multiple reference dll’s, Copy Local property should be set to true for each dll. This property is not required to be set for system .Net assemblies such as “System.Data”, “System.Core”,etc.
Once the project is built successfully, the ILMerge utility will create a folder named “ILMerge” in the \bin\(Debug or Release) directory based of build type.
“ILMerge” folder will contain the single merged dll and it can be uploaded to KTA .Net Assemblies store.
Additional configuration can be done using a config file – https://github.com/emerbrito/ILMerge-MSBuild-Task/wiki/Config-File
For further reading and reference – https://github.com/dotnet/ILMerge