C# in VS Code needs three things to line up: a .NET SDK on the PATH, the C# extension or C# Dev Kit installed and activated, and a folder open that contains a project or solution. When any one is missing you get the classic symptoms — no IntelliSense, no error highlighting, or a run button that does nothing. Each has a specific check.
Step 1: the SDK#
dotnet --version
dotnet --list-sdks
If either fails, VS Code cannot work; install the .NET SDK — the SDK, not just the runtime — and open a new terminal. If it works in a standalone terminal but not in VS Code’s integrated terminal, VS Code was launched before the PATH changed. Restart it fully.
On macOS and Linux, if the SDK is installed somewhere non-standard, tell the extension where:
{ "dotnet.dotnetPath": "/usr/local/share/dotnet" }
Step 2: the extension#
There are two, and the difference matters:
| C# (ms-dotnettools.csharp) | C# Dev Kit | |
|---|---|---|
| Provides | Language server, debugging | Solution explorer, test runner, project templates, plus the C# extension |
| Licence | Free | Free for individuals and small teams; same terms as Visual Studio Community |
| Works in VS Code forks | Partly | No |
Install the C# Dev Kit if you are in VS Code itself; it pulls in the C# extension. In a fork such as Cursor or VSCodium, install only the C# extension. Having both plus an old OmniSharp-based extension leads to two language servers arguing, which is a common cause of “sometimes works”.
Check what is running: View, Output, then choose C# from the dropdown. A healthy start shows the language server loading your project. Errors here name the actual problem.
Step 3: open the right folder#
This is the one that catches most people. The language server looks for a .sln or .csproj in the folder you opened. If you opened a parent folder with several projects, or a subfolder with only source files, it finds nothing and silently gives you plain-text editing.
- Open the folder containing the solution or project file, not its parent.
- If there are several solutions, run .NET: Open Solution from the command palette and choose one.
- The status bar shows which project is loaded. If it shows nothing, nothing is loaded.
# Make a valid project to test the editor with
dotnet new console -n Hello
code Hello
If IntelliSense works in that fresh project, your setup is fine and the problem is the original folder’s layout.
IntelliSense works, but no red squiggles#
Errors come from the build, and by default the Dev Kit shows diagnostics for open documents only. Two settings change the scope:
{
"dotnet.backgroundAnalysis.analyzerDiagnosticsScope": "fullSolution",
"dotnet.backgroundAnalysis.compilerDiagnosticsScope": "fullSolution"
}
If a file shows no errors at all when it obviously has some, check the Problems panel filter and confirm the file belongs to the loaded project — files excluded from the project by a wildcard rule in the .csproj are not analysed.
Run and debug do nothing#
With the Dev Kit, F5 should prompt for a debugger and run. If it does not:
- Confirm the project builds from the terminal:
dotnet build. The editor cannot run what does not build. - Delete any stale
.vscode/launch.jsonfrom an old setup; the Dev Kit generates its own configuration. - If you need a custom one, run .NET: Generate Assets for Build and Debug.
The fallback that always works is the terminal: dotnet run in the project folder. If that works and F5 does not, the problem is purely editor configuration.
Slow or stuck loading#
Large solutions take time to load, and a full restore on first open can look like a hang. Watch the C# output log; if it is still printing, wait. If it has stopped with an error, the usual culprits are a project targeting an SDK you do not have installed, or a NuGet restore failure behind a proxy.
dotnet restore # see the real error, with proxy or feed problems
dotnet --list-sdks # is the version in global.json installed?
cat global.json
Reset when nothing else works#
- Uninstall every C#-related extension, including old OmniSharp ones.
- Delete
binandobjfolders from the project. - Reinstall the C# Dev Kit.
- Run Developer: Reload Window.
Ten minutes, and it resolves the accumulated-state problems that no individual setting fixes.
Questions people ask#
Do I need Visual Studio instead?
Not for most work. VS Code with the Dev Kit handles console apps, web APIs, Blazor and tests well. Visual Studio still has the edge for WPF and WinForms designers and for very large solutions.
Why does the Dev Kit ask me to sign in?
The licence is tied to a Microsoft account, as with Visual Studio Community. Signing in is required once; the plain C# extension does not ask.
Can I use it with Unity?
Yes, with the Unity extension for VS Code, which configures the project for the editor. Set VS Code as the external script editor inside Unity.
Does it work on Apple Silicon and ARM Windows?
Yes. Install the ARM64 build of the SDK, not the x64 one, or the extension will complain about architecture.
Where to go next#
- Introduction to C# — once the editor is working.
- What’s new in C# 14 and .NET 10 — including file-based apps.
- VS Code extensions not working — when the extension itself will not load.