Selecting and checking the SDK
To write and build C# projects, install a .NET software development kit (SDK), not just a runtime. The SDK includes build tools and the runtime needed for development. This track targets .NET 10 with C# 14. The recorded lab pin is SDK 10.0.404; it is a reproducibility pin, not a recommendation to ignore newer security updates.
Check what your terminal can find
Open a terminal after installing the SDK from the official .NET download or installation documentation. Choose the supported package for your operating system and CPU architecture: for example, x64 or Arm64. On Windows and macOS use the matching installer; on Linux follow the instructions for your distribution and release rather than mixing repositories. Do not copy an installer command for a different distribution. A terminal resolves the dotnet executable through its search path (PATH).
Read the three version reports
dotnet --version reports the SDK selected for the current directory; --list-sdks inventories SDKs visible to that host; --list-runtimes lists installed shared runtimes visible to the host. An installed SDK can differ from the selected one. These reports do not prove that a particular app builds. The host architecture can affect which installations you see.
Pin a reproducible SDK
A global.json file in the project workspace or an ancestor can constrain SDK selection. The fixture uses an exact version and disables roll-forward; if the SDK is missing, SDK commands fail rather than choosing a different one. In an ordinary maintained project, a reviewed roll-forward policy and security update process may be preferable. The SDK pin does not set the target framework of an application.
Examples and walkthroughs
dotnet --versiondotnet --list-sdksdotnet --list-runtimesCompare the selected SDK with the list of installed SDKs. Output is machine-dependent; a hypothetical matching SDK line begins with 10.0.404, while a runtime line may begin with Microsoft.NETCore.App 10.0.15. Paths and installed versions vary.
{ "sdk": { "version": "10.0.404", "rollForward": "disable", "allowPrerelease": false }}Save as global.json in a disposable workspace. With the matching SDK present, dotnet --version should report 10.0.404. This fixture has not been run here.
Common mistake and correction
If dotnet is not recognized, check installation and PATH, then open a fresh terminal. If a runtime appears but no SDK appears, install the SDK. If an SDK exists but a pinned project fails to select it, inspect global.json before editing source. Do not remove working installations to diagnose a missing SDK.
Try it yourself
Given a fictional workstation with SDKs 10.0.404 and 11.0.100 and runtime 10.0.15, explain which SDK a global.json with version 10.0.404 and rollForward disable selects. Explain what happens if that SDK is absent. No installation is required.
Next: Console project anatomy. These examples are static study material; actual C# compilation and ByteMind execution have not been verified.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Selecting and checking the SDK — knowledge check
Apply the lesson concepts to the following scenarios.
Which command reports the SDK selected for the current directory?
A machine lists shared runtimes but no SDKs. What is missing for normal C# project builds?
An exact global.json pin is missing locally. What should happen with rollForward disabled?
What should determine the installer architecture?
What does changing global.json directly control?