Project layout, NuGet restore, debugging basics
Explore the project layout (.csproj), how NuGet restore works, and simple debugging techniques for beginners.
Project layout, NuGet restore, debugging basics is a free C# Academy lesson on CoddyKit. This is lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the C# Academy learning path, and your progress syncs across the web and the CoddyKit app. The C# Academy course includes 3 lessons in total.
Lesson overview
Goal: Learn about project structure, restoring NuGet packages, and debugging basics.
Project layout
A console project usually contains:
- .csproj file (project settings and package refs)
- Program.cs (your code)
- Folders for additional classes or tests
Project file sample
The .csproj lists the target framework and packages.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>NuGet restore
dotnet restore downloads NuGet packages so builds succeed.
- Pulls package versions from .csproj
- Caches them locally
Debug basics
Debugging tips:
- Set breakpoints and step through code
- Use Console.WriteLine for quick checks
- Check values in the debugger locals window
Bug check example
A small sample showing a possible bug. Guard with conditions to avoid runtime errors.
using System;
public class Program
{
public static void Main(string[] args)
{
int x = 10;
int y = 0;
// Potential bug: division by zero
if (y != 0)
{
Console.WriteLine("Result = " + (x / y));
}
else
{
Console.WriteLine("Avoided division by zero!");
}
Console.WriteLine("Debugging tip: add checks before risky operations.");
}
}
dotnet restore
Quick check: What does dotnet restore do?
Recap
Recap: .csproj defines your project, dotnet restore fetches packages, and simple checks or breakpoints help debug effectively.
Learn C# with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 93
- Lessons
- 346
Frequently Asked Questions
Is the “Project layout, NuGet restore, debugging basics” lesson free?
Yes — the full text of “Project layout, NuGet restore, debugging basics” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the C# Academy course, upgrade to CoddyKit PRO. The C# Academy course includes 3 lessons in total.
What will I learn in “Project layout, NuGet restore, debugging basics”?
Explore the project layout (.csproj), how NuGet restore works, and simple debugging techniques for beginners. You practise C# Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start C# Academy?
No prior experience is required. C# Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 3.
How long does the “Project layout, NuGet restore, debugging basics” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this C# Academy lesson?
Yes. Every C# Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What is C#, CLR/.NET, JIT vs AOT, SDK & dotnet CLI
- First Program: top-level statements vs Program class; build & run
- Project layout, NuGet restore, debugging basics