Can You Compile C# Using Only The Command Line? (No IDE)

If you want to run some c# code, you use Visual Studio or some other IDE.

But have you ever wondered what the IDE is doing when it executes the code? What magic happens when you press the green play button?

Turns out it's just running msbuild which is a command-line tool.

Now, Visual studio calls msbuild using custom arguments that are proprietary to Visual Studio. But you can use it yourself to build and run any .NET code.

The simplest command looks like this:
MSBuild.exe path/to/MyProj.proj -property:Configuration=Debug

Run that in the directory where msbuild and it'll build your project.

For a full explanation of all that you can do with it, look at Microsoft's documentation.