This is the beginning of a new series of learning how to code in C#. It’s also just a simple standalone article on how to set up a C# Console App in Visual Studio, and gives an overview of what the code means and how to get started coding with VS. I hope to empower others to be able to make games like my own game, Puzzledorf.

This is current as of Visual Studio Community 2022, version 17.6.2. They keep changing small things but the main gist is likely the same. If there are big changes in a later version and this needs updating, please let me know in a comment.
Instructions
- Install Visual Studio (If Not Installed): If you don’t have Visual Studio installed, you can download and install it from the official Microsoft website. Choose the version that suits your needs; Visual Studio Community is a popular free version.
- Open Visual Studio: Launch Visual Studio after installation. You’ll see the start screen with various options.
- Create a New Project:
- Click on “Create a new project” or go to
File -> New -> Project...
- Click on “Create a new project” or go to
- Select Project Template:
- Choose your language from the drop down (select C# in this case)
- In the “Create a new project” dialog, search for “Console” in the search bar at the top.
- Choose the “Console App (.NET Core)” or “Console App (.NET Framework)” template, depending on the version of Visual Studio you’re using.

- Configure the Project:
- Choose a name and location for your project. You can also select the solution location.
- I’m calling mine “MyFirstConsoleApp”
- Click “Next.”

- Configure Project Settings:
- Choose the desired framework version. I just leave this at default.
- Click the “Create” button to create the project. Visual Studio will generate the necessary files and folders.
- Write Code:
- In the Solution Explorer window (usually on the right), you’ll see your project files.
- Double-click the
Program.csfile to open it in the code editor.
- Default code:
- The default code used to have a function called Main. As of VS Community 2022, version 17.6.2, that no longer appears to be the case. Instead what I see is the default “Hello world” program which looks like this:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Let’s assume you see that code too. If not, delete whatever code is there and replace it with the above code, and we can talk about it below.
- Run the Application:
- Press
Ctrl + F5or go toDebug -> Start Without Debuggingto run the application. You can also press the play button.
- Press

Run it, and you’ll see the console window showing the message “Hello World!” followed by some text that tells you that the program exited and is waiting for you to press a key.
Understanding the Default Code
Let’s break down the different parts of this code and explain what’s happening:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
The first line is what we call a comment. Any time a line starts with //, that’s a comment. A comment means, it’s something written for human eyes only. It’s not part of the code that the computer will read – the computer will in fact skip over that line of code. This is why there is a web address there – it’s telling the programmer where they can go for more information.
Console – Console, in this context, is what we call a Class. I’ll talk more about that elsewhere, so don’t worry about it just now, but basically, by typing the word Console here, it allows us to access lots of pre-written code stored inside the Console class.
Console.Writeline()
Writeline() is what we call a function. A function is just a block of code that does something; it carries out some sort of command. When we put the word Console in front of it, that’s because this function, this block of code, sits inside the Console class. When we type Console. first, that’s how we get access to the code in the Console class, in this case, the function called WriteLine().
WriteLine simple writes a line of code, as the name says. It will write whatever text is between the () parentheses, inside the “” quote marks. So:
Console.Writeline(“Hello, World!”);
This line literally means:
- I want to use the function called WriteLine in the Console class.
- And I want the WriteLine function to print the words Hello, World!
The ; on the end of the line means, “This is the end of my line of code.”
It’s the equivalent of a full stop for code. Remembering to use them is good grammar and prevents errors.
How To Set Up a Test Project
In the next article I will explain how to set up a test project, and the differences between doing that and how code in Unity works.
If you liked this article, please check out Puzzledorf to show your support. If you enjoy playing, leaving a review helps the games visibility on Steam.



Leave a comment