π Instructions#
With your environment ready, you can create your first project. A project is the folder and set of files that make up a program. VS Code uses a project structure to know how to build and run your code.
You’ll create a Console App β a program that runs in the console and takes text input and output. That’s exactly what you’ll be building throughout this course.
π Learn More
β What to Do#
Create a new C# Console App named ConsoleGamesLibrary in Visual Studio Code.
π― Expected Outcome#
Your project folder should contain these files:
ConsoleGamesLibrary/
ConsoleGamesLibrary.csproj
ConsoleGamesLibrary.sln
Program.cs
Open Program.cs β it should contain a single line:
Console.WriteLine("Hello, World!");π‘ Hints#
Hint 1
Open the Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac). This is where you’ll find the .NET: New Project command.
Hint 2
The Command Palette will walk you through a sequence of prompts β project type, name, folder, and solution format. Don’t close it or press Escape at any point or it will reset and you’ll need to start again.
Hint 3
When asked for the solution file format, select .sln. When asked for the project name, type exactly ConsoleGamesLibrary β capitalisation matters for C# projects.
β οΈ Common Mistakes#
No folder open in VS Code before running the command
The .NET: New Project command creates the project inside the folder that’s currently open in VS Code. If no folder is open, the command may fail or put files somewhere unexpected. Open a folder first via File β Open Folder.
Closing the Command Palette mid-way
The project wizard runs as a sequence of prompts in the Command Palette. Pressing Escape or clicking away resets it β no files are created. If this happens, open the Command Palette again and start from .NET: New Project.
Typing the wrong project name
The project is named ConsoleGamesLibrary β one word, no spaces, capital C, G, and L. A wrong name won’t break anything, but your file structure won’t match the expected outcome and later steps will refer to ConsoleGamesLibrary by name.
π Solution#
Tried, you must, before reveal the solution you may.
- Open the Command Palette with
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(Mac). - Type
.NET: New Projectand select it. - Select Console App.
- Enter
ConsoleGamesLibraryas the project name. - Confirm the folder and press Enter.
- Select .sln as the solution format and press Enter.