In this article in the About Visual Basic series about the .NET Framework tools, we learn how to actually write a program in CIL - the language of .NET and compile it using the .NET language independant compiler, ILASM.EXE. This article was inspired by an example in C# that I found in a soon to be published APress book, C# and the .NET 2.0 Platform, Third Edition by Andrew Troelsen.
About Visual Basic has recently featured a series about the .NET Framework tools. The series includes:
ILDASM - the Intermediate Language Dis-Assembler
NGEN - the Native Code Generator
GACUTIL - the Global Assembly Cache Utility
AL and VBC - Multi-file (and multi-language) Assemblies
SN.EXE - The Strong Name tool
Another very handy tool, and one that tends to tie the concepts of all the others together, is ILASM.EXE - the Intermediate Language Assembler.
A technology that is involved in all of these is the awesome language of .NET with the awful name: Common Intermediate Language, or CIL.
CIL is the key part of .NET that makes it possible for all .NET languages to share the same .NET Framework. When you "Build" a Visual Basic .NET executable (or a C# or J# or any .NET language executable), what you're actually doing is creating the source code for the CIL version of the program. The compile into actual machine code that can be run by your computer isn't done until the last moment when you run the executable. Although it's very different technically, you might think of CIL as holding approximately the same "position" as the old Assembler Language of the original PC architecture.
The Common Language Runtime or CLR is the component of .NET that compiles the CIL source. The Common Language Infrastructure or CLI is the .NET infrastructure that includes all these technologies. You may have heard that Microsoft has turned over the key .NET technology to an international standards group. The CLI is what they standardized.
This is how the .NET Framework tools discussed so far tie in.
- ILDASM converts the executable (.EXE or .DLL) created by a Visual Basic build into CIL source code.
- NGEN converts the CIL based executable into a native code executable for your computer.
- GACUTIL helps you work with the native code executables on your computer already.
- VBC is the actual compiler used by Visual Studio and directly at a command prompt.
- SN lets you create "strong names" for shared assemblies in the GAC.

