user997112
user997112

Reputation: 30655

View assembly code produced from compiling VS 2010 C#.net?

I found a thread on here detailing how to view assembly code produced for VS C++, but I cannot seem to find a way in which I can view the assembly for C#.net code?

Is this possible? It doesnt appear to be as simple as the c++ version.

Thank you in advance

Upvotes: 0

Views: 1654

Answers (4)

Darrel Lee
Darrel Lee

Reputation: 2470

Reflector was nice, but was taken over by RedGate and is no longer free.
But Telerik has an awesome free tool called JustDecompile (http://www.telerik.com/products/decompiler.aspx)

It will even create a Visual Studio solution for the assembly.

We are still talking IL disassembly here. If you want to see the native code, I believe you can display that in the Visual Studio debugger.

Upvotes: 0

Yahia
Yahia

Reputation: 70369

you can take the result of C# compiler or ANY .NET EXE/DLL and open it for example in Reflector (commercial) or ILDasm (free) - these will display the IL code.

Another option is to debug the result in VS - the debugger can show IL code too.

Some links:

IF you really want Assembler code (similar to the C++ result) then you can use http://msdn.microsoft.com/en-us/library/6t9t5wcf.aspx together with any Disassembler.

Upvotes: 0

Oded
Oded

Reputation: 499372

You can see a disassembled version of the IL produced by compiling a .NET code base by using a dissembler such as Reflector or ILDasm.

These show you the Intermediate Language that the code gets compiled into.

The .NET assemblies (not the same as assembly code) do get jitted later on to native code, though you can also use ngen.exe to generate the native code before hand.

Upvotes: 1

Preston Guillot
Preston Guillot

Reputation: 6724

.NET languages don't directly produce ASM through compilation, they produce CIL, which is interpreted by the .NET runtime into assembly instructions using JIT compilation. http://en.wikipedia.org/wiki/Common_Intermediate_Language for details.

It is possible to produce a native binary from C# using NGEN to produce a machine specific binary, which is generally used to improve applicaiton start-up times, but you're going to be better off looking at at the IL.

Upvotes: 0

Related Questions