Skip to content

cs compiler

Zeioth edited this page Feb 9, 2024 · 19 revisions

C# can be compiled in two different ways.

The generic way

If your project doesn't have a .csproj file, use the options Build & run, Build, or Run, and C# will be compiled using the command csc (c sharp compiler).

The dotnet way

If your project has a .csproj file, use the options Build & run dotfile or Build dotfile, and C# will be compiled using the command dotnet (which also uses csc underhood, actually).

dotnet automatically install the necessary nuget packages for you. So you don't need to do anything.

In case you need to add nuget packages to your project, or other advanced operations, use the command dotnet --help on the terminal.

screenshot_2024-02-09_17-25-59_428300715

Be aware by default dotnet do not make the executable distributeable. If you want to distribute your program to be able to run it in a different machine, you will have to run dotnet publish on the terminal. Then you will find the resulting .exe under ./bin/net8.0/publish.