repo/toolchain-pinned/dotnet
Toolchain version is pinned
Implements repo/toolchain-pinned for dotnet.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | dotnet |
| Scope | each |
| Kind | expr |
| Source | library v0.8.0 |
| Selected by | fleetlint-recommended@v0.8.0 |
Requirement
global.json sets sdk.version, or .tool-versions/mise or devbox.json names dotnet with a version. In devbox.json the package needs a version (dotnet-sdk@9.0.100, dotnet-sdk_9); @latest does not count.
Why
Without a pin, every machine and every CI run builds with whatever compiler or runtime happens to be installed, and failures cannot be reproduced.
Check
["", "../", "../../", "../../../"].exists(d, file(d + "global.json") && text(d + "global.json").matches(r'"version"\s*:\s*"\d')) || ["", "../", "../../", "../../../"].exists(d, file(d + ".tool-versions") && scan(d + ".tool-versions", r'^\s*(dotnet|dotnet-core)\s+\S*\d').size() > 0) || ["", "../", "../../", "../../../"].exists(d, ["mise.toml", ".mise.toml", ".config/mise.toml", ".config/mise/config.toml", "mise/config.toml"].exists(n,
file(d + n) && scan(d + n, r'^\s*"?(dotnet|dotnet-core)"?\s*=\s*[^#\n]*\d').size() > 0))
|| ["", "../", "../../", "../../../"].exists(d, file(d + "devbox.json") && text(d + "devbox.json").matches(r'"(dotnet-sdk)(@v?\d|"\s*:\s*("v?\d|\{[^}]*"version"\s*:\s*"v?\d))|"(dotnet-sdk_\d+(_\d+)?)(@[^"]*)?"'))Fix
Run dotnet new globaljson --sdk-version <version> --roll-forward latestFeature.
Agent instruction (from repo/toolchain-pinned): Add the stack’s toolchain pin set to the version currently installed; do not upgrade the toolchain in the same change.
A finding that names no file points at global.json.
Sources
- https://fleetlint.org/baseline/#hygiene (convention)
- https://mise.jdx.dev/configuration.html (spec)
- https://github.com/jetify-com/devbox/blob/main/.schema/devbox.schema.json (spec)
- https://fleetlint.org/stacks/
- https://learn.microsoft.com/en-us/dotnet/core/tools/global-json (spec)
- https://fleetlint.org/stacks/#net
Generated by fleetlint docs from catalog v0.8.0.