Search code examples
c#.netassemblieslocateprobing

Where is the assembly file?


i created a simple application , and i read in a book that the C# or any .net program is converted to an assembly file contains assembly code , but i`d like to know where to locate that assembly file .


Solution

  • All C# programs (and more generally, any .NET language) are converted to a .NET "Assembly", which is an .exe or .dll that contains intermediate bytecode - CIL. That bytecode is compiled down to machine langauge when you run your program on-the-fly by the JIT compiler.

    By default, Visual Studio will place the .NET Assemblies in your project's /bin folder, and then the chosen configuration under that. (by default only 2 exist, /bin/Debug and /bin/Release) You can change this in the project properties.

    There is no assembly code in a .NET assembly, but you can view the CIL bytecode with tools like ildasm.exe or Mono.Cecil.

    The JIT compiler has the benefit of being able to detect the system's current hardware configuration and apply optimizations based on the CPU's features. There would be no purpose in looking at the stuff the JIT generates, as that will be different from computer to computer.