public static void PrepareUpgrade(IInstall instance) { var settingsPath = Path.Combine(instance.GetLocation(), "settings.json"); byte[] settingsData = null; if (File.Exists(settingsPath)) settingsData = File.ReadAllBytes(settingsPath); instance.Uninstall(); Directory.CreateDirectory(instance.GetLocation()); if (settingsData != null) File.WriteAllBytes(settingsPath, settingsData); }