Haneef Puttur

Run First C# From Command Line Using Notepad in Windows

Step1. Create a .cs file

Open Notepad and paste following text

using System;
namespace HelloWorldApplication
{
   class HelloWorld
   {
      static void Main(string[] args)
      {
         /* my first program in C# */
         Console.WriteLine("Hello World");
         Console.ReadKey();
      }
   }
}

Save above file as test.cs

Step 2 :
Open CMD

Paste this command

Path = C:\Windows\Microsoft.NET\Framework\v2.0.50727

Step 3

Test by typing csc

Step 4 

This will compile and create file test.exe

Step 5:

.

Exit mobile version