diff --git a/src/Squirrel/UpdateManager.InstallHelpers.cs b/src/Squirrel/UpdateManager.InstallHelpers.cs index 126fd20c..5fd5195c 100644 --- a/src/Squirrel/UpdateManager.InstallHelpers.cs +++ b/src/Squirrel/UpdateManager.InstallHelpers.cs @@ -32,16 +32,12 @@ namespace Squirrel var zp = new ZipPackage(pkgPath); // NB: Sometimes the Uninstall key doesn't exist - using (var parentKey = - RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default) - .CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree)) {; } + using var parentKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default) + .CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree); - var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default) + using var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default) .CreateSubKey(uninstallRegSubKey + "\\" + applicationName, RegistryKeyPermissionCheck.ReadWriteSubTree); - // we will try to find an "app.ico" from the package, write it to the local app dir, and then - // use it for the uninstaller icon. If an app.ico does not exist, it will use a SquirrelAwareApp exe icon instead. - var targetIco = Path.Combine(rootAppDirectory, "app.ico"); if (File.Exists(targetIco)) key.SetValue("DisplayIcon", targetIco, RegistryValueKind.String); @@ -65,7 +61,7 @@ namespace Squirrel var estimatedInstallInKb = compressedSizeInKb + (compressedSizeInKb / 0.38d * 2); var dwordsToWrite = new[] { - new { Key = "EstimatedSize", Value = (int)estimatedInstallInKb }, + new { Key = "EstimatedSize", Value = (int) estimatedInstallInKb }, new { Key = "NoModify", Value = 1 }, new { Key = "NoRepair", Value = 1 }, new { Key = "Language", Value = 0x0409 }, @@ -74,10 +70,13 @@ namespace Squirrel foreach (var kvp in stringsToWrite) { key.SetValue(kvp.Key, kvp.Value, RegistryValueKind.String); } + foreach (var kvp in dwordsToWrite) { key.SetValue(kvp.Key, kvp.Value, RegistryValueKind.DWord); } + key.Flush(); + return Task.FromResult(key); } @@ -98,4 +97,4 @@ namespace Squirrel key.DeleteSubKeyTree(_config.AppId, false); } } -} +} \ No newline at end of file