Compiling .NET code often results in
multiple assembly files being created, including satellite DLLs, all of which
are required for the program to run. While this is a non-issue during
development, when it comes to deployment it often means an unwanted stage of
users having to unzip files, or manually move certain DLLs to specific places.
is capable of merging the code from referenced DLLs into the main assembly,
producing a single application for deployment and so greatly simplifying the
When merging dependencies, SmartAssembly completely
integrates the dependency code into the main assembly code. Instead of making
public calls (by name), the resulting assembly instead makes internal calls by
Member ID. As well as making deployment easier, this also provides some level
of protection against people examining and reverse-engineering sensitive code.
Merging referenced DLLs is a simple
process. After adding the main assembly to a project as the input, and
selecting an output destination, SmartAssembly automatically scans for
dependencies and presents a list. We select the DLLs we wish to merge and click
‘Build’ to generate the output file.
Figure 1: Merging assemblies with
dependencies in SmartAssembly
There are some limitations to what can be
successfully merged. For example, some third-party DLLs will include integrity
protection, which causes the DLL to fail to load as its contents will appear to
have been modified.
For these instances, SmartAssembly
supports dependency embedding, which allows referenced DLLs to be embedded into
the main assembly as resources, instead of being merged into the main
assembly’s contents. It is also capable of compressing these resources and
dynamically uncompressing them at runtime, significantly reducing the
distributed file size.
Figure 2: The difference between merging
and embedding assemblies
As well as merging and embedding
dependencies, SmartAssembly can apply powerful obfuscation to assemblies, preventing
malicious users from decompiling them. It can also add Automated Error
Reporting, a sophisticated mechanism for receiving reports of any unhandled
exceptions which occur when your application is used in the wild, along with
all the data needed to diagnose them.
SmartAssembly can be controlled through the
command-line, so it is easily integrated into the build process, providing
simple, reliable merging of dependencies on every build.
Learn more about SmartAssembly,
or download your free
Red Gate Software produces ingeniously simple tools for Microsoft technology professionals worldwide. We currently specialize in MS SQL Server, Cloud, .NET and Oracle database tools. Established in 1999, we are based in the beautiful, if rather flat, university town of Cambridge, UK