.net Desktop Runtime 8 (Limited ›)

if (result == MessageBoxResult.Yes)

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'."

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; .net desktop runtime 8

var result = MessageBox.Show( "This app requires .NET Desktop Runtime 8.0.4 or higher. Download now?", "Missing Runtime", MessageBoxButton.YesNo);

// In App.xaml.cs or Program.cs using Microsoft.Win32; private static bool IsDesktopRuntimeInstalled() if (result == MessageBoxResult

Environment.Exit(1);

// Direct download link for the Desktop Runtime Process.Start(new ProcessStartInfo FileName = "https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=win-x64&apphost_version=8.0.4", UseShellExecute = true ); Your user has 8

You build your app against 8.0.4 . Your user has 8.0.1 installed. Your app tries to load and fails with: "Application has stopped working" or a silent crash in event logs. Why? Starting with .NET 8, the runtime rolls forward, but only within certain bounds. If your app is published as framework-dependent (the default), it requires the exact same major.minor version (8.0.x). A missing 8.0.4 dependency will break. The Fix: Two Professional Strategies Stop telling users to "go download a runtime." Here are your two reliable solutions. Strategy 1: Self-Contained Deployment (The "Nuclear Option") Publish your app with the runtime bundled inside the .exe . No runtime installation required.