Can Roslyn compile C # to CIL

Can the Roslyn C # compiler be used to compile C # human readable CIL code? Like the examples given here: https://en.wikipedia.org/wiki/Common_Intermediate_Language

I know it can generate bytecode in EXE / DLL form, but I am interested in CIL code.

Either from the command line or from the API.

I know the disassembler can be used in bytecode files, but I would prefer a more direct approach.

Thank.

+3


source to share


2 answers


Just call ildasm.exe as a post build step. Solutions should be compound steps instead of one monolithic monster.



+2


source


C # will automatically compile to CIL. This is the target plate. (* Not sure about .NET Native / UWP).

Since it seems to me that your goal is to show the generated CIL code, have a look at Msiler :



687474703a2f2f692e696d6775722e636f6d2f6974444d3133412e676966.gif

If you happen to use Resharper, IL-Viewer is included .

0


source







All Articles