title: Why do .NET Core and .NET 5 generate an executable?
body: <p>I have a question that I'm very confused about. The way I understand .NET is like this:</p>
  
  <ul>
  <li>C# Application (source code) -> </li>
  <li><code>csc.exe</code> (compiler) -> </li>
  <li>.NET application (which is in MSIL)</li>
  </ul>
  
  <p>If so, why is the output from building a .NET app a Windows executable? I thought the whole idea was that your source code compiles down to MSIL, which targets the locally installed CLR. However, both .NET Core and .NET 5 generate a windows executable, which run atop of the operating system, not in a virtual machine.</p>
  
  <p>This is unlike Java, which compiles to a <code>.class</code> bytecode file (not an <code>.exe</code>), and those files <em>do</em> run atop a virtual machine (or, later, you can package all the class files into a <code>.jar</code>).</p>
  
  <p>What I'm trying to ask is: Why doesn't the C# compiler generate a specific application file type that runs atop .NET? E.g., a <code>.net</code> file that is associated with the common language runtime?</p>
  
  <p>My best guess is that the Windows <code>.exe</code> generated is <em>not</em>, in fact, a Windows executable, but instead some kind of .NET executable. But, in that case, why can't it run on any platform with .NET Core? Linux doesn't know what an <code>.exe</code> file is.</p>