Once you've typed in the "Hello, World" code, open a command window and navigate to the folder where the HelloWorld.cs file is. Now type in the following: -
If everything works correctly, you should see results similar to those shown in Figure 3-2, where the compiler name and version are displayed along with any errors or warnings. As you can see, I'm using a beta version of the compiler at the time of this writing. Despite the version of the compiler you're using, you should not see any errors or warnings as a result of this simple example.
Figure 3-2 Compiling HelloWorld.cs should result in no errors or warnings.-
If you receive an error along the lines of 'csc' is not recognized as an internal or external command, operable program or batch file, it probably means that you haven't installed the .NET SDK, which includes the C# compiler.
If you invoke the C# compiler incorrectly-such as passing it an invalid file name-or you call it with the /? argument, the compiler will list every possible switch that can be set when compiling your applications. I don't want to bog down this discussion with descriptions of all the flags that can be set for the compiler, so instead I'll focus on the switches salient to the current discussion, and you can investigate the rest at your leisure.