How do I view C# Assembely code or convert C# code into Assembly code?

Locked How do I view C# Assembely code or convert C# code into Assembly code?

  • Thursday, September 10, 2009 7:40 PM
     
     
    I was just wondering if its possable to view the compiled Assembly code and if so how? If I can't is there any way to convert my C# code into Assembly code?

    Thank you

    -Zach115th

All Replies

  • Monday, March 15, 2010 3:00 PM
     
     
    You don't able make that, Because after compiling c#, Produce private assembly files..
  • Monday, July 19, 2010 10:25 AM
    Moderator
     
     Proposed

    Hmm, maybe I missunderstood what you are looking for.

    When you compile c# or VB.Net (or any other .Net Language), MSIL is generated. That can be viewed by different tools.

    One tool is MSIL Disassembler (Ildasm.exe): http://msdn.microsoft.com/en-us/library/f7dy01k1(VS.71).aspx

    Another tool that is used by a lot of people is the .Net Reflector: http://www.red-gate.com/products/reflector/

    The output of the .Net compiler is - like Java - very easy to decompile / read, so there are tools outside to make that harder. But that is some other topic and does not belong here.

    Hopefully I was able to help you a little.

    With kind regards,

    Konrad

    Edit: Just corrected some spelling.


    MCTS SQL Server 2008, Database Development
  • Saturday, February 11, 2012 12:31 PM
     
     

    dear konrad

    I have created a windows application. it has only one form and form has one button control, on click on button, i am showing a message. I build the project and create a exe. when i decompile this exe using .Net Reflector,it decompile successfully but I am not able to view the Form1 in design mode. it shows the error. it creates WindowsApplication_VB.Form1.resources and WindowsApplication_VB.Resources.resources.

    waiting for your reply

    regards

    mahesh

  • Sunday, February 12, 2012 12:05 PM
    Moderator
     
     

    Hi Mahesh,

    first of all I have to poitn put a few points that hopefully help for further requests:

    a) It is never a good idea to add new questions to an old thread. The thread you replied to was started in 2009! A lot of people will not read the thread any longer. So it might be much better to start a new thread.

    b) Always try to choose a forum that fits best. This forum covers the developer documentation and Help System only. Maybe your question fits better to a VB forum or so.

    Regarding your problem: (I cannot fully test it now, because Reflector is a commercial application now and I am no longer using it. Instead I am using dotPeek / Resharper).

    You need to give the exact error message. Else we cannot help you. I can only guess now: Visual Studio splits forms up: you have one code file and one designer.vb file with code that is maintained by the designer. This could be a problem if the designer does not start.
    Also important: Tools like reflector are very nice to have a look how a method is implemented. But these tools are NOT really usefull to decompile an application to compile it again. As good as they are: There are some things that makes it quite difficult up to impossible.

    And also important inside forums: Why do you do this? Most people who try to help earn their money with software development and we do not help people "hacking" our software. Normaly there should be no requirement for a decompile + a new compile. Just use the source + project instead!

    With kind regards,

    Konrad