0

I have read a lot of articles about difference between .NET SDK and .NET Runtime, but I still don't understand what parts of .NET SDK contain compilers. I know that .NET SDK contains:

  • CLR (with JIT compiler)
  • Class libraries (BCL, FLC, etc.)
  • Documentation
  • Header files
  • compilers (csc.exe, vbc.exe)
  • ???

But .NET is multi-language platform. There are more than two languages (C#, VisualBasic). So my question is how many compilers I get when I install .NET SDK?

Joseph Katzman
  • 1,959
  • 6
  • 21
  • 47
  • 2
    What problem is it that you're trying to solve? Do you have a practical programming problem? – mason Feb 23 '22 at 17:22
  • 1
    @mason I just want to understand .NET platform better. The question is clear enough. I don't think that practical questions more important than theoretical questions. – Joseph Katzman Feb 23 '22 at 17:30
  • While `csc`, `vbc`, and `fsc` (for C#, VB.NET, and F# respectively) constitute "compilers" by your example, consider other build tools included in the SDK, for example, do you consider the Razor compiler to be a "compiler"? – Dai Feb 23 '22 at 17:30
  • @Dai Good question, but now I'm thinking in terms of a simple console application. – Joseph Katzman Feb 23 '22 at 17:31
  • What about now-obsolete and dead compilers that used to be shipped in-box, like the J# and JScript.NET compilers? What about C++/CLI and MC++? – Dai Feb 23 '22 at 17:32
  • @Dai So I'm a bit confused. According to your comments I understand that .NET SDK contains `csc`, `vbc`, `fcs` compilers. What about other? Do SDK contains compilers for all .NET compatible languages? – Joseph Katzman Feb 23 '22 at 18:10
  • 1
    @JosephKatzman See my answer. The (current) .NET SDK includes only compilers for those 3 languages. As for other .NET-compatible languages, **no**: Microsoft will not redistribute compilers for languages they don't own (e.g. IronPython and [Oxygene](https://en.wikipedia.org/wiki/Oxygene_(programming_language))) - as for other Microsoft-owned .NET languages: Microsoft doesn't want to have to maintain support for those languages, so it's not in their interests to include them in the SDK. – Dai Feb 23 '22 at 18:18
  • @JosephKatzman I've updated my answer just now after doing some software-archeology for you. – Dai Feb 23 '22 at 18:55

1 Answers1

3

But .NET is multi-language platform. There are more than two languages (C#, VisualBasic). So my question is how many compilers I get when I install .NET SDK?

If you're asking about distinct "top level" applications-programming languages officially supported by recent releases of the SDK for .NET 6, .NET 5, and .NET Core 3.1, then the answer is 3:

  • csc.exe or csc.dll for C#, based on Roslyn.
  • vbc.exe or vbc.dll for VB.NET, based on Roslyn.
  • fsc.exe or fsc.dll for F#.

I don't know when the .NET SDK included the F# compiler in-box, but it was not part of the .NET Framework 4.x SDK.

I note that normal runtime-only installations of the .NET Framework 4.x still included csc.exe, vbc.exe, and jsc.exe.

I did some software archeology by looking through the original .NET Framework 1.0, 1.1, and SDKs and (non-SDK) runtime installers and I've compiled this table:

Language Compiler .NET FX 1.0 .NET FX 1.1 .NET FX 2.0 .NET FX 3.0 .NET FX 4.x .NET Core 1.0 .NET Core 2.x .NET Core 3.x .NET 5 .NET 6
C# csc.exe Runtime + SDK Runtime Runtime Runtime Runtime csc.dll csc.dll csc.dll
VB.NET vbc.exe Runtime + SDK Runtime Runtime Runtime Runtime vbc.dll vbc.dll vbc.dll
JScript.NET jsc.exe Runtime + SDK Runtime Runtime Runtime Runtime
C++ for CLR cl.exe SDK SDK SDK (Windows SDK) (Windows SDK)
J# vjc.exe SDK (Only in CD/ISO releases)
F# fsc.exe SDK fsc.dll fsc.dll

So if you wanted the "most" compilers in your .NET SDK, then go for .NET Framework 1.1, as that gives you five compilers.

There was no .NET Framework 3.0, 3.5, nor 4.0 SDK as it was rolled-into the main Windows SDK.

I don't have canonical data for .NET Core 1.0 SDK and 2.0 SDK.

Since .NET Core 3.x, the compilers are intended to be invoked via dotnet instead of via csc.exe hence the rename from csc.exe to csc.dll.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Now I'm wondering why does .NET Runtime contains compilers like `csc.exe`, `vbc.exe`. The purpose of the runtime is to run .NET application which has been already compiled. So it should work with managed assemblies. The JIT compiler will compile IL code to machine code. – Joseph Katzman Feb 23 '22 at 18:58
  • 3
    @JosephKatzman ASP.NET WebForms makes use of runtime compilation of `.aspx`/`.ascx`/`.master` files, and the built-in `CodeDom` library also meant programs needed access to runtime compilation services. JScript.NET also supports `eval()` which would necessitate bringing `jsc.exe` along. Anyway, the size of `csc.exe` and its related dependencies isn't _that_ big. The biggest surprise to me that was Microsoft kept `jsc.exe` alive through to .NET Fx 4.8 - I haven't really paid any attention to it since ~2005. – Dai Feb 23 '22 at 18:59