1

Can I get visual studio to save the intermediate code when I compile a c# program? I'm trying to learn how to program a CIL program and think this would be useful as I can't find any documentation.

M Y
  • 1,831
  • 4
  • 24
  • 52
  • 1
    Not that I know of, but you can use a decompiler like [ILSpy](http://ilspy.net/) for this. – InBetween Sep 15 '17 at 16:42
  • 1
    In practice this isn't useful, but occasionally I find myself inspecting the IL using ILSpy. VS will not produce intermediate artifacts. –  Sep 15 '17 at 18:23
  • 4
    Possible duplicate of [How to generate IL source code with csc (C# compiler) or dmcs (mono C# compiler)?](https://stackoverflow.com/questions/7231983/how-to-generate-il-source-code-with-csc-c-compiler-or-dmcs-mono-c-sharp-comp) – Jacob Krall Sep 15 '17 at 20:03
  • 4
    Your compiled program _is_ CIL. You can view it in a human-readable form by loading it into `ildasm` or one of many freely available decompilers. The compiler only writes IL in its binary form; it will not let you output to a symbolic IL format. – Mike Strobel Sep 15 '17 at 20:15

1 Answers1

-1

I don't think it's a good idea to code directly into CIL. see the compilation process of a C# program

Maybe, can help you visual studio tools, specifically developer command prompt, run command ildasm and open your assembly (*.dll or *.exe file) and the code CIL is revealed

This is a common problem for businesses, see more in Why You Need Obfuscation?

karritos
  • 344
  • 2
  • 9