Compile C# Without Visual Studio
Microsoft's C# is probably the second most popular language in use today (Java Script being the most popular).
C# was developed by Microsoft when they found that they couldn't abide by their Java license agreement with Sun Microsystems.
So C# is virtually a copy of Java. Because of the dominance of Windows, C# took off in popularity immediately.
A today C# is gaining even more popularity because of its use in the development of mobile apps.
I have never been very excited about C# because, unlike Java, you have to use Visual Studio to write programs
with it. I don't like to use over-complicated IDEs to write programs because the IDE is often more difficult to figure
out than the programming language itself. The fact of the mater is there are also over-complicated IDEs for writing
Java programs if you want to use them, and you actually can write C# programs without Visual Studio.
In order to write C# programs, you must have the .NET Framework installed on your computer. The odds are
pretty good that it's already installed, but to make sure, check the following path:
At that location you should find a file with the version of the frame work, for example v2.0.50727. If not, you can
download and install it from Microsoft's website for free.
With the .NET Framework installed, you can use Windows Notepad to write your C# program. Shown below is
the code for a simple "Hello World" program, which you can cut and paste into a Notepad file.
static void Main()
// wait until user presses Enter key
Save the file with the extension .cs (for example helloworld.cs).
Next, use Windows Notepad to create a DOS batch file which will be used to compile the program. Shown below
is the text for the batch file, which you can cut and paste into a Notepad file.
rem set the location of the C# compiler
Save the file with the extension .bat (for example compile.bat). This code sets the location of the C# command
line compiler and then executes it, passing the name of the source file. When you double-click on the the batch file,
it should create a .exe file (for example helloworld.exe).
When you double-click on the .exe file, a console window will appear with the message "Hello World!". Press the
Enter key to close the program. Congratulations, you are now a C# programmer.
Note, like Java, more complex C# programs are created by compiling code classes into separate DLL files.
The line shown below tells the compiler to compile the code into a DLL.
%framework%\csc /t:library filename.cs
Of course, then you have to tell the main program to use the library, and you have to use the "new" keyword to actually
create an object of that class. But that's beyond the scope of this article. I just mention it to get you started.