Skip to main content

Merging Files into a Single .NET Assembly

Image result for .NET assembly
.NET assemblies can be single-file or multifile.  






As I've been preparing to take Microsoft Exam 70-483, I came across the Al.exe command, a tool which is installed along with Visual Studio. Al stands for "Assembly Linker" and when you run it, it "links" different manifest or resource files together into a single assembly. If you work with .NET at all, you probably have a pretty good idea of what an assembly is, but here's a simple definition from Stack Overflow:
"A chunk of (precompiled) code that can be executed by the .NET runtime environment. A .NET program consists of one or more assemblies." -Adrian Grigore
Here's a more technical definition from Wikipedia:
 "A compiled code library used for deployment, versioning, and security."
 Normally when you create a new project in Visual Studio, VS pretty much creates the assembly for you. You don't have to worry about merging different files together using the command prompt. Part of that assembly will be a manifest file. Again, if you live around .NET, you probably know what that is, but here's a short and sweet explanation from Microsoft anyway:
"Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata."
Even though the C# compiler will create a manifest for you when you begin a new project, you can also create your own user-defined manifest if you want to fiddle with versioning, security or some other manifest-related facet of your app.

While you can manually run the Al.exe command to merge different files and manifests into a single assembly, most of the time .NET developers don't directly deal with it. It only gets noticed when it doesn't work. This could happen if you are using a very old version of VS. Browsing online, I haven't seen anyone having problems with it since 2010 or 2011. However, in the off-chance you are having issues, try downloading the most recent version of Visual Studio and see if that fixes the problem.


*Image credit: https://docs.microsoft.com/en-us/dotnet/framework/app-domains/assembly-manifest

Comments

Popular posts from this blog

How NOT To Write Code / How To Decipher Bad Code

Confusing code is bad code. In this post I'll be talking about one of the worst coding practices: using nondescript variables. As an example, we'll be looking at a simple problem from Project Euler (#28). I'll give you an example using really bad code and then we'll look at how we can decipher it and make it more clear and understandable. First, here's the problem: Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21  22 23 24  25 20   7   8   9  10 19  6   1   2 11 18   5   4   3  12 17  16 15 14  13 It can be verified that the sum of the numbers on the diagonals is 101. What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way? Ok, so now check out this solution:             int i = 1; int j = 1; int s = 0; ...

Programming in R

Image saved from my new ShinyApp Over the past few days I've been playing around with R, a statistical language which is essentially an offshoot of S, which was created in the 1980's. R has some powerful features which enable to it rapidly create meaningful graphical illustrations. I've really enjoyed manipulating some of the datasets on Kaggle with it. Here's a ShinyApp I published to demonstrate a simple R program to track where different plant and animal species live within the US national parks.