Setup: Install the .NET 10 SDK

Install the .NET 10 SDK with winget, and check from Git Bash that the dotnet command works.

Novice · Operating System · C# · Updated

After this lesson you can

  • Install the .NET SDK and check its version with the dotnet command

Key takeaways

  • The .NET SDK holds the C# compiler, the runtime that runs your programs, and the dotnet command.
  • winget install -e --id Microsoft.DotNet.SDK.10 installs the .NET 10 SDK, which comes with C# 14.
  • After an install, open a new terminal. Then dotnet --version should print a version that starts with 10.0.
  • dotnet --list-sdks lists every SDK you have, and dotnet uses the newest one unless a project asks for another.

Windows only. .NET is the platform C# programs run on. The .NET SDK (software development kit) contains everything you need to build and run them:

  • the C# compiler, which turns your code into something the computer can run;
  • the runtime, which runs it;
  • the dotnet command, which you type in the terminal to create, build, run and test your programs.

We use .NET 10, a long-term support (LTS) release, which Microsoft supports with updates until November 2028. It comes with C# 14, the version of the language this course teaches.

Visual Studio, which you install next, can bring its own copy of the SDK. Installing it yourself first means the dotnet command works in Git Bash, whatever Visual Studio does.

Install the SDK

In Git Bash, run:

winget install -e --id Microsoft.DotNet.SDK.10

Click Yes if Windows asks whether the app may make changes. The install takes a minute or two.

Check your work

Close Windows Terminal completely and open it again, so Git Bash sees the new program. Then run:

dotnet --version

You should see a version that starts with 10.0., such as 10.0.403. The numbers after 10.0 change with each monthly update, so yours may be newer.

To see every SDK on your computer, run:

dotnet --list-sdks

Each line shows a version and the folder it lives in, C:\Program Files\dotnet\sdk. It's fine to have more than one: dotnet uses the newest one unless a project asks for another.

Common problems

What you see What to do
bash: dotnet: command not found Close every Windows Terminal window and open a new one. If it still fails, sign out of Windows and back in.
dotnet --version shows 8.0 or 9.0 An older SDK is installed and the new one isn't. Run the install command again and read its message.
A fatal error occurred. The folder [C:\Program Files\dotnet\host\fxr] does not exist The install didn't finish. Run winget uninstall -e --id Microsoft.DotNet.SDK.10, then install it again.
winget says No package found matching input criteria Check the id's spelling. winget search Microsoft.DotNet.SDK lists the SDKs winget knows.

Check yourself

2 questions to try on the lesson page.

So what

The dotnet command is how you build and run every C# program in this course, from a one-line file to a full web app. If dotnet --version prints 10.0, you're ready for C#.

Key terms