You build a .NET solution in Visual Studio Code by installing the .NET SDK plus the C# Dev Kit extension, then using the dotnet CLI to create projects and a .sln file and VS Code to edit and debug them. As of the November 2026 toolchain, the reliable pattern is: the CLI owns solution and project structure, VS Code owns editing, testing, and debugging. That division matters because VS Code doesn't have a built-in solution explorer for .NET; the C# Dev Kit extension supplies one, and it expects the solution file and project files to be well-formed and already on disk. Get those in place first and everything else—IntelliSense, debugging, test discovery, multi-project navigation—follows.

This guide walks through prerequisites, creation, adding projects, references, building, debugging, testing, and the failure modes that trip people up most.

Prerequisites: what must be installed before anything works

You need three things, and the order matters.

  1. The .NET SDK. This is the compiler, runtime, and dotnet CLI in one package. Install the SDK, not just the runtime—the runtime can't create or build projects. On Windows, the SDK installer handles PATH automatically. On macOS and Linux, package-manager installs or the official install scripts handle it. Verify with:

That should print a version number like 10.0.1xx. If it errors, the SDK isn't on your PATH and nothing else in this guide will work.

  1. Visual Studio Code itself. Any current stable release is fine. Avoid very old builds; extension compatibility depends on a reasonably recent VS Code engine.

  2. The C# Dev Kit extension (which pulls in the base C# extension as a dependency). Install it from the Extensions view (Ctrl+Shift+X), search "C# Dev Kit," and install. Microsoft also offers the "C# Dev Kit" bundled inside the "Extension Pack for .NET" if you want testing and refactoring extras in one step.

One common confusion: there are older guides telling you to install only the "C#" extension. As of the current toolchain, the base C# extension handles IntelliSense and debugging, but the Dev Kit adds the Solution Explorer, test explorer integration, and project-aware tooling. Install the Dev Kit for a solution-based workflow.

A success check for this whole section: open a terminal, run dotnet --list-sdks and confirm at least one SDK line prints, then open VS Code and confirm the C# Dev Kit shows as installed and enabled (not just downloaded).

Creating a solution from scratch

The dotnet CLI creates solutions and projects. VS Code does not need to be open yet—in fact, it's cleaner to scaffold first, then open the folder.

A solution file (.sln, or the newer XML-based .slnx format supported by recent SDKs) is just a container that lists projects. It doesn't compile anything by itself; the build system resolves projects through it.

Here's an ordered procedure.

Step 1 — Make a folder and enter it.

Step 2 — Create the solution file.

This produces MyApp.sln in the current directory. The -n flag names it; without it, the folder name is used.

Step 3 — Create the first project.

This creates a subfolder MyApp.Console containing a .csproj file and Program.cs. For a web API you'd use dotnet new webapi -n MyApp.Api; for a class library, dotnet new classlib -n MyApp.Core. Run dotnet new list to see every installed template.

Step 4 — Add the project to the solution.

On recent SDKs, dotnet sln add MyApp.Console also works because it finds the single project file in the folder. The explicit path is safer when you're unsure.

Step 5 — Open the folder in VS Code.

Or use File → Open Folder. Open the folder that contains the .sln file, not the project subfolder—this is the single most common setup mistake. If you open the project folder instead, the Solution Explorer won't show the solution structure, and multi-project references get confusing.

Success check: the Solution Explorer panel in the VS Code activity bar shows MyApp with MyApp.Console nested under it. If it doesn't appear, use the Command Palette (Ctrl+Shift+P) and run ".NET: Open Solution," then pick the .sln file.

Adding more projects and wiring references

Real solutions usually have a library, an application entry point, and a test project. The reference graph is what the SDK uses to resolve types across projects, and it's independent of the solution file—the .sln lists projects, while .csproj files declare who references whom.

Adding a class library:

Making the console app depend on the library:

That command edits the console project's .csproj to add a entry. This is the mechanism by which MyApp.Console can using types defined in MyApp.Core.

Adding a test project:

The template choice (xunit, nunit, mstest) determines which test framework packages get added. xUnit is the most common default in modern .NET templates; the workflow is identical regardless.

After adding projects, VS Code may need a moment to reload the workspace. If IntelliSense in MyApp.Console doesn't see MyApp.Core types, run ".NET: Restart Language Server" from the Command Palette before assuming something is broken.

A note on project naming and namespaces: templates derive the root namespace from the project name. MyApp.Core gets namespace MyApp.Core, so classes live at MyApp.Core.Something. You can override this with -n and the --namespace option on some templates, or by editing the property in the .csproj. Keep names consistent early; renaming later ripples through using statements.

Building and reading build output

The build command compiles all projects in the solution and resolves references:

Without arguments, dotnet build in a folder containing exactly one .sln or project file finds it automatically. Being explicit avoids surprises in folders with multiple candidates.

VS Code mirrors this: Ctrl+Shift+B (or Terminal → Run Build Task) runs the configured build task, and the Problems panel shows compiler errors with file and line references you can click.

What success looks like: output ends with Build succeeded and a warning/error count of zero or a known set. The compiled assemblies land in each project's bin/Debug// folder.

What failure looks like, and what it usually means:

error CS0246: The type or namespace name ... could not be found — a missing reference or missing using. Check that the project reference exists (dotnet list MyApp.Console/MyApp.Console.csproj reference) and that the package is restored. error NETSDK1004: Assets file not found — NuGet restore hasn't run. Run dotnet restore or just rebuild; build normally restores first. error MSB3644 or target-framework mismatches — one project targets a framework the installed SDK doesn't support. Check in each .csproj against dotnet --list-sdks. Mixing net8.0 and net10.0 across projects is legal only if the referencing project targets a compatible or newer framework.

If the build fails only in VS Code but succeeds in a terminal, the workspace is probably pointed at the wrong folder or the language server is stale. Restart the language server, then re-check the folder you opened.

Debugging: launch configurations that actually hit breakpoints

Debugging in VS Code requires a launch configuration in .vscode/launch.json. The C# Dev Kit can generate one: open the Run and Debug view, click "create a launch.json file," and pick the .NET option. It typically offers configurations for each executable project.

A minimal configuration for a console app looks like this (properties simplified):

Three details cause most debugging failures:

The program path must match your target framework and configuration. If the project targets net10.0 but the path says net8.0, the launcher can't find the DLL. Check in the .csproj and confirm the folder exists under bin/Debug/. Also confirm whether you're building Debug or Release.

The preLaunchTask must exist. It refers to a task in .vscode/tasks.json named build. The Dev Kit's generated files include it. If you deleted or renamed the task, the launch fails before running your code—the error names the missing task.

cwd matters for file paths. A console app reading appsettings.json with a relative path resolves it against the working directory. Setting cwd to the project folder makes relative paths behave the way they do when you run dotnet run from that folder.

Success check: set a breakpoint (click the gutter left of a line number), press F5, and confirm execution pauses with the yellow highlight and the Variables panel populated. If breakpoints show as hollow circles and never bind, the debugger attached to a different build than the one you edited—rebuild and relaunch.

F5 debugging works for web projects too, but trust the HTTP launch profile over a hand-written config. For ASP.NET Core apps, the generated configuration uses ASPNETCORE_ENVIRONMENT and a URL; check Properties/launchSettings.json in the web project for the port and environment it expects.

Running tests inside the editor

Test discovery depends on the test project referencing a test framework package and the Dev Kit's testing integration. After the test project is in the solution and restored:

1: Open the Testing view in the activity bar (flask icon). 2: If nothing appears, run ".NET: Refresh Test Explorer" or reload the window. 3: Run individual tests with the gutter play icon, or all tests with the run-all control.

The CLI equivalent is dotnet test MyApp.sln. It builds and runs every test project in the solution. To scope it: dotnet test MyApp.Tests/MyApp.Tests.csproj --filter "FullyQualifiedName~Calculator".

A practical check: in the test explorer, run one test and confirm it passes both there and via dotnet test. Divergence usually means the test explorer is stale or the solution open in VS Code is not the one the terminal build is using. Also verify a failing test actually fails—write a deliberately wrong assertion once to confirm the pipeline reports failures rather than silently passing.

Working across multiple projects without losing your place

Once the solution has three or more projects, navigation becomes the friction point. A few habits keep it manageable.

Use Go to Definition and Find All References. F12 jumps to a symbol's definition across projects, which is why the project reference graph must be correct—if MyApp.Console didn't reference MyApp.Core, the language server treats the library types as unknown and the jump fails.

Keep the Solution Explorer as the source of truth for structure. It shows the dependency tree visually. Right-click a project to add references or manage NuGet packages through the UI, which edits the .csproj for you.

Restore after pulling changes. When a teammate adds a package or project, your local assets can be stale. dotnet restore MyApp.sln followed by a language server restart clears most "phantom" errors. A quick tell: an error references a namespace that plainly exists in the repo file—probably a restore issue, not a code error.

Watch NuGet package version drift. Each .csproj lists its own PackageReference versions. Without central package management (the Directory.Packages.props feature), two projects can pull different versions of the same library, and you'll see warnings or subtle runtime mismatches. If you hit that, adopt central package management or align versions manually. That's a structural fix, not something VS Code can paper over.

Fixing the four failure modes you'll hit most

These account for the bulk of "it doesn't work in VS Code" reports. Distinguish the symptom from the cause before editing anything.

Symptom: no IntelliSense, red squiggles everywhere, but dotnet build succeeds. Cause: the language server loaded a different folder or is stale. Fix (reversible): run ".NET: Restart Language Server," confirm the opened folder contains the .sln, reload the window. If still broken, check the C# extension output pane for a load error naming a project file.

Symptom: Solution Explorer is empty even though a .sln exists. Cause: the folder is one level above or below the solution, or the Dev Kit didn't activate. Fix: run ".NET: Open Solution" and select the file explicitly; if that fails, confirm the Dev Kit is enabled, not merely installed.

Symptom: build fails with missing package or asset errors after a git pull. Cause: restore hasn't run. Fix: dotnet restore, then rebuild. Verify with dotnet build --no-restore—if that succeeds, restore was indeed the gap.

Symptom: debugger launches, then exits instantly with no output. Cause: typically a wrong program path, a stale build, or an unhandled exception at startup whose output routes to a different console setting. Fix: build clean, confirm the DLL path exists, and try "console": "integratedTerminal" to see startup output. Check the Debug Console pane for exceptions before assuming the configuration is at fault.

A sensible stop condition: if a build works in a terminal but fails in the editor after a language server restart and a clean restore, and the errors point to tooling rather than code, don't keep reinstalling extensions—check the C# Dev Kit's output log for the specific load failure. Persistent, reproducible toolchain faults that survive a clean reinstall and a fresh clone of the repo are worth escalating to whoever maintains the build environment rather than debugging indefinitely in the editor.

Where this workflow bends, and what to check

The CLI-first pattern is stable across Windows, macOS, and Linux because the dotnet commands are the same everywhere; only install paths and shell conventions differ. A few boundaries are worth flagging honestly.

The .slnx format is supported by current SDKs and modern Dev Kit versions, but if you work on a team with mixed tooling versions, some older tooling and scripts assume classic .sln. If a build server or a peer's IDE can't read .slnx, fall back to .sln—conversion is a one-command step in recent SDKs, but verify on the machine that will consume it.

Template output changes between SDK releases. dotnet new console in an older SDK produces a Program.cs with a top-level Main class; newer SDKs default to top-level statements. Both compile; the difference matters when you follow an older tutorial and paste a class-based Main into a top-level-statements file and get duplicate-entry-point errors. Delete one, don't mix them.

Extension behavior tracks the SDK. If you upgrade the SDK but keep an old C# Dev Kit, you may see analysis gaps or unsupported-framework warnings. Keep both reasonably current and check the extension's output log after an SDK upgrade. This is precisely the kind of version-specific compatibility question where the answer depends on your installed versions—run dotnet --list-sdks and check the extension's version and release notes before assuming a bug.

Finally, VS Code never replaces the terminal for this stack. It adds editing, navigation, and debugging convenience on top of a CLI that owns creation, restore, and build. Leaning on that division—CLI for structure, editor for code—is what keeps a .NET solution predictable as it grows from one project to ten.