Get Started Using C# Without Visual Studio

This post will show you how to get started using the C# programming language without installing Visual Studio or any other IDE. C# is a great programming language to learn for anyone new to programming.

Regardless of the language, most fundamentals behind programming can be practiced and learned using only a text editor and the command line. Using the command line to compile and run code provides a faster way for new programmers to get going. It eliminates the tasks of having to download and learn an IDE environment like Visual Studio.


  • Windows operating system
  • Text editor

What is C#?

C# is a modern multi-paradigm programming language created and developed by Microsoft. It runs on the .NET framework and works with any platform. It has similarities to C++ and Java. C# is simple, which makes it a great language to learn how to program with.

The .NET Framework

The Microsoft .NET Framework is a software development framework that consists of a class library called the Framework Class Library (FCL) and a runtime environment called the Common Language Runtime (CLR). It is used for the development and use of console, desktop, Web, and mobile applications.

If you are using Windows 7 or higher you should already have the .NET Framework installed. You can make sure by checking Programs and Features in the Control Panel and see if Microsoft .NET Framework is listed.

If you have been using your operating system for awhile and have updates installed like I do, then you may see several different versions listed. However, it should have Microsoft .NET Framework listed somewhere or look similar to this:

Screen shot of Progams and Features window

If you don’t have the .NET Framework installed, you can download and install the latest version from the Microsoft .NET download page.

Add the C# Compiler’s Path as an Environment Variable

Once you have the .NET Framework installed, you need to find the C# compiler and add the path as a system environment variable or else you will have to navigate to or use the full path of the C# compiler in the command prompt every time you compile and run a C# program. The compiler is usually located as csc.exe under the path:


In my case the latest version I have right now is under v4.0.30319 so the path for csc.exe on my computer is:


Where your version may possibly be different. There are several different ways to access the environment variables depending on what version of Windows you are using. To keep things simple I’m going to add the path as a system environment variable using the command prompt by entering (remember to edit the end of the path):

setx Path “%PATH%;C:\Windows\Microsoft.NET\Framework\YourInstalledVersionHere”

Once the path is added you should see a line that says “SUCCESS: Specified value was saved.” as in the screenshot below:

Screen shot of Command Prompt window

Now you will need to close the command prompt and re-open it for the change to take effect. Once you have the command prompt re-opened, enter csc and you should get some output as in the screenshot below:

Screen shot of Command Prompt window

If you receive an error that ‘csc’ is not recognized then you may have entered something incorrectly when you set the path to the environment variable. Check what you entered for the setx command and make sure you have the correct path entered.

Compiling and Running C# Programs

Now that the environment variable is set we can compile and run C# programs from any directory. First we need to create a C# Program. Open your favorite text editor (I’m using Notepad++ for this) and save a new file as HelloWorld.cs to a location that you prefer. Copy and paste the following code into the file and save:

class HelloWorld
    static void Main()
        System. Console.WriteLine("Hello world!");

Now in the command prompt type cd and enter the path to where you saved the HelloWorld.cs program. I saved my program under a folder I created called Csharp in the root directory so I will enter:

cd C:\Csharp 

To compile the program enter:

csc HelloWorld.cs

You should receive output similar to when you entered csc the first time except without the warnings. This will create a new executable file named HelloWorld.exe in the same directory.

Now that the program is compiled you can enter HelloWorld to run the executable. You should get the same output as in the screenshot below:

Screen shot of Command Prompt window

When compiling your C# programs from the command prompt you can also do different things like specify an alternate location or filename for the executable file that is created by using the /out parameter like:

csc /out:HW.exe HelloWorld.cs

This sets your executable file name to HW so that when you run the program you can enter HW. To view all of the C# compiler options enter csc /? into the command prompt.

Learn More About Programming and C#

Now that you know how to create a C# program file, compile it, and run it, you are ready to learn more. If you are serious about learning how to program using C# then I recommend reading Fundamentals of Computer Programming with C# by Svetlin Nakov and Team. The book focuses more on the fundamentals of programming rather than C# and the .NET Framework specifically. It has problems at the end of every chapter that you can use to practice and test your knowledge.

Another great place to start is the C# Guide located in the Microsoft .NET Documentation. The guide has several different sections to help new developers, developers new to C#, and experienced C# developers learn more. It gives you the opportunity to learn from the source itself.

comments powered by Disqus