What does the C# compiler produce, and what is IL?
Quick Answer
The C# compiler (Roslyn) doesn't produce machine code. It produces Intermediate Language (IL / CIL) plus metadata, packaged in an assembly (.dll/.exe). The CLR then JIT-compiles the IL to native code for the current CPU when methods run.
Compiling C# doesn't give you a native executable. Roslyn produces Intermediate Language — a CPU-independent, stack-based instruction set — plus metadata that describes all the types, and it bundles those into an assembly. When you run the app, the CLR JIT-compiles the IL to native code for whatever processor it's actually running on. That's why one assembly can run on x64 and ARM, and it's also why decompilers like ILSpy can reconstruct fairly readable source.
- IL is a stack-based, CPU-independent instruction set — the same assembly runs on x64, ARM, etc.
- Metadata describes every type and member; it's what reflection reads and what lets languages interoperate.
- Tools:
ildasm, ILSpy, dnSpy, orildbgto inspect IL; SharpLab to see it online. - Because the source is recoverable from IL, ship-time obfuscation exists but is imperfect.