public void UpdateUninstallRegisty() { var releaseContent = File.ReadAllText(Path.Combine(rootAppDirectory, "packages", "RELEASES"), Encoding.UTF8); var releases = ReleaseEntry.ParseReleaseFile(releaseContent); var latest = releases.Where(x => !x.IsDelta).OrderByDescending(x => x.Version).First(); var pkgPath = Path.Combine(rootAppDirectory, "packages", latest.Filename); var zp = new ZipPackage(pkgPath); var installInfoFile = Path.Combine(this.rootAppDirectory, ".installInfo.json"); var installInfoResult = Utility.GetInstallInfo(installInfoFile); if (installInfoResult.Success) { var verion = installInfoResult.InstallVersion as string; var productCode = installInfoResult.ProductCode as string; var appName = installInfoResult.AppName as string; var arch = installInfoResult.Arch == "x86" ? "x86" : "x64"; var key = GetUninstallRegKey(productCode, appName, arch); if (key != null) { try { key.SetValue("DisplayVersion", zp.Version.ToString()); key.Close(); this.Log().Info($"UpdateUninstallRegisty: DisplayVersion updated to {zp.Version.ToString()}"); } catch (Exception ex) { this.Log().ErrorException("UpdateUninstallRegisty: Failed to write current version to registry.", ex); } } else { this.Log().Error("UpdateUninstallRegisty: Registry key not found or no write access. Unable to update current version."); } } else { this.Log().Error("UpdateUninstallRegisty: Unable to update current version without installInfo."); } }