.Net Framework FAQ

Submit Interview FAQ
Home » Interview FAQ » .Net FrameworkRSS Feeds

How can I produce an assembly?

  Shared By: Barachias Levi    Date: Oct 17    Category: .Net Framework    Views: 1303


The simplest way to produce an assembly is directly from a .NET compiler. For example, the following C# program:

public class CTest
public CTest() { System.Console.WriteLine( "Hello from CTest" ); }
can be compiled into a library assembly (dll) like this:

csc /t:library ctest.cs
You can then view the contents of the assembly by running the "IL Disassembler" tool that comes with the .NET SDK.

Alternatively you can compile your source into modules, and then combine the modules into an assembly using the assembly linker (al.exe). For the C# compiler, the /target:module switch is used to generate a module instead of an assembly.