.NET › .NET CLI, SDK & Project Structure (csproj)
How do global.json files pin a specific .NET SDK version for a project or repository?
IntermediateAnswer
A global.json file specifies the exact SDK version (and optional roll-forward policy) that `dotnet` commands should use when building within that directory tree, ensuring consistent builds across developer machines and CI regardless of which SDK versions happen to be installed globally.
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestMinor"
}
}Real-world example A large enterprise repo commits a global.json pinning SDK 8.0.100 so that a developer with SDK 9.0 preview installed locally still builds using the officially supported 8.0.100 toolchain.