You don’t need Visual Studio for simple C# projects. Everything you need is included when you install the .NET Framework, except a decent text editor. (I highly recommend Notepad++)

To get started, you’ll need to install the .NET Framework, if you haven’t already done so, and set up several environment variables. I first create a user environment variable named DOT_NET_HOME whose value is the absolute path to the location of the csc.exe file for your particular version of .NET. (See Figure 1)

Setting Environment Variables

I then edit the user’s Path environment variable to include the DOT_NET_HOME variable. To reference one environment variable in another, enclose the referenced variable in percent characters like so: %DOT_NET_HOME%   For a detailed tutorial on how to set environment variables in Windows 10 you can watch this video:

Next, create source files with your text editor of choice. For this example I’ll create a class named MyClass with Notepad++ as shown in Figure 2.

Creating MyClass.cs Source File

Save the file and enter the source code for your class. I’ll keep this example simple. Here’s the code:

using System;

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

Here’s my finished source file:

Figure 3: MyClass.cs Source Code Complete

Open up a console window and navigate to where you saved the source file and use the csc command to compile the file like so:

csc MyClass.cs

If it compiles successfully the result will be a new file named MyClass.exe. Here are the results of compiling and running MyClass:

Compiling and Running MyClass

That’s it!