How do I manage .NET SDK version selection and roll‑forward for self‑contained C# deployments on Windows, Linux, and macOS?
0 reputation · 17 Feb 2021, 20:00 UTC
When deploying a C# application as a self‑contained package, I need to ensure the correct .NET runtime is bundled while also controlling which SDK version is used for building and publishing across different operating systems. The CLI chooses the latest SDK unless a global.json overrides it, and runtime roll‑forward can affect which version runs on target machines. I am uncertain how to reliably pin the SDK version, configure roll‑forward behavior, and verify that the published output contains the exact runtime patch I intend.
How can I enforce a specific SDK version via global.json for dotnet build and publish? What roll‑forward settings should I apply to avoid unexpected runtime changes? How do I confirm that the self‑contained deployment includes the desired runtime version?