internal static void EnsureAssociationSet(string extension, string fileTypeDescription, string exePath, string programId) { bool commit = false; commit |= SetCurrentUserRegistryKey(@"Software\Classes\" + extension, programId); commit |= SetCurrentUserRegistryKey(@"Software\Classes\" + programId, fileTypeDescription); commit |= SetCurrentUserRegistryKey($@"Software\Classes\{programId}\shell\open\command", "\"" + exePath + "\" \"%1\""); if (commit) { Interop.SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, IntPtr.Zero, IntPtr.Zero); }