A passionate programmer’s findings in the world of internet.

How To: Getting Started With C#

January 7th, 2006

I've worked with a few other .NET languages before, but this is my very first time to get my hands on C#. Since I haven't installed the .NET framework on my very old Windows 2000 (in office), I guess it might be a good idea to write a simple guide on how I get my C# "Hello World" running. So, C# experts, this is not for you, but you can drop me a line if I made any mistakes.

First, you would need to have the .NET Framework from Microsoft. As soon as I get myself to the page, I see that there are 3 versions of the framework (1.0, 1.1 and 2.0).

Which version of .NET Framework and SDK?

I remember my previous installation of the framework was 1.1. I'm not sure whether I should try 2.0 or stick with 1.1. I don't know the difference between 1.1 and 2.0. Some searches brought me to a discussion on 1.1 vs. 2.0 at gotdotnet. From them, I understand that 2.0 is just another new version with some bug fixes.

So, I decided to go for .NET Framework 2.0. Again, I see a few choices for me. Since I'm not using 64 bit PC, I'll just download:

  1. .NET Framework Version 2.0 Redistributable Package (x86)
  2. .NET Framework 2.0 SDK x86

Note that you will have to install it according to that sequence. It should take you a great deal of time with the size of 22.4MB and 362.5MB.

Installing the Framework and SDK

After downloading, I get a dotnetfx.exe (framework) and setup.exe (SDK). Again, make sure you install it follow the correct sequence.

Run dotnetfx.exe and every installed easily except for the slow processing speed of my Pentium III that made the installation a little bit tedious.

Next, run setup.exe. It's ready to use with a few clicks on the setup wizard.

Writing Hello World Program

For testing purpose, start up notepad and typed (or copy-and-paste) the following code into it.

using System;
class Hello {
public static void Main() {
Console.WriteLine ("Hello World!");

Then, save it as Hello.cs.

Compiling and running the program

If you installed it at the default location, you shoud be able to find your SDK command prompt at:
Start > Programs > Microsoft .Net Framework SDK v2.0 > SDK Command Prompt

Start it up then go to the location where you have saved your Hello.cs. Compile it with the following command in the SDK command prompt.

csc Hello.cs

If it returns no error, run the program with the following command.


You can expect the program to tell you "Hello World!" now.


Developer.com - Getting Started with C#
New and Improved Security in the .NET Framework 2.0

If my article helped you solved your problem, consider buy me a beer!

Share this article: del.icio.us | digg it

Related posts:

One Response

Felix Leong says:

… Not to mention that they “explode” their library base. I’m particularly fond of the new UI enhancements they had for .NET2.0, which makes flexible and fluid program layout possible without cracking your head to write UI workarounds to programmatically readjust the size of elements to make a fluid layout, like most UI library.