If you have ever shipped a WPF or Windows Forms application, you have received that support ticket: "The app won't open. It says something about 'missing runtime'."
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true Zero runtime dependencies. Works on Windows 7, 10, 11, and Server 2016+. Cons: Large file size (~70-120 MB per app). Must redeploy to update runtime. Strategy 2: Bootstrap with the Official Detector (The "User-Friendly" Way) Keep your app small (framework-dependent) but add a runtime check on startup. .net desktop runtime 8
const string runtimeKey = @"SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App"; using var key = Registry.LocalMachine.OpenSubKey(runtimeKey); var installedVersion = key?.GetValue("Version") as string; If you have ever shipped a WPF or
Environment.Exit(1);
April 13, 2026 | Read Time: 4 minutes
Use Microsoft's official WindowsDesktop.Runtime NuGet package to detect the exact required version: using var key = Registry.LocalMachine.OpenSubKey(runtimeKey)