How can I view MSIL / CIL generated by C# compiler? Why is it called assembly?

前端 未结 13 995
南方客
南方客 2020-11-28 18:53

I\'m new to .NET C# programming. I\'m following few books. It is said that instead of compiling it directly to binary code (Native code). High level code is converted into i

相关标签:
13条回答
  • 2020-11-28 19:34
    1. Yes it is in assembly.
    2. You need .NET Reflector or ILDasm.
    3. More details on assembly check HERE.

    P.S As you are following some books I will highly recommend you CLR via C#.

    0 讨论(0)
  • 2020-11-28 19:37

    sharplab is an online tool, great for simple use cases. Type your code on the left, IL shows up on the right.

    0 讨论(0)
  • 2020-11-28 19:37

    I know this is an old question, and I'd prefer any of the tools above. However, in a pinch, there has been an MSIL viewer in the box with Visual Studio since at least Version 2005.

    The tool is named ildasm.exe, and is located in the following folders after default Visual Studio installations:

    Visual Studio 2005 "C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin\ildasm.exe"

    Visual Studio 2008 "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\ildasm.exe"

    Visual Studio 2010 "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\ildasm.exe"

    For more information, see: "How to: View Assembly Contents" in the MSDN Library.

    0 讨论(0)
  • 2020-11-28 19:40

    I you want to view the intermediate language, Try downloading JustDecompile from Telerik (Which is currently free, requires a sign up though).

    Drag in your DLL and choose IL from the drop down box at the top!

    0 讨论(0)
  • 2020-11-28 19:43

    I have just spent a couple of hours searching for the best tool that could let me view the IL code directly inside Visual Studio.

    The only solution I found so far is Msiler https://visualstudiogallery.msdn.microsoft.com/60fc53d4-e414-461b-a27c-3d5d2a53f637

    it works quite well!

    Otherwise the second best solution, but without visual studio integration, is JetBrains dotPeek, which is quite awesome to be honest.

    0 讨论(0)
  • 2020-11-28 19:44

    If you want it online, .NET Fiddle is excellent. Just paste your code and click View IL option at the top right.

    0 讨论(0)
提交回复
热议问题