c# - AutoUpdater.NET 不更新也不删除旧程序
问题描述
我在 WPF 程序中使用AutoUpdater和 Visual Studio 安装程序项目。更新我的项目时,它从未真正更新过。它只提供“修复”或“删除”我现有安装的选项。这会导致程序总是要求更新(因为它仍在旧版本 1.0.0.0 上)。
我的更新代码(MainWindow.xaml.cs):
AutoUpdater.Start(@"\\SERVER\foo\bar\update.xml", new NetworkCredential("user", "pass"));
AutoUpdater.ShowSkipButton = false;
AutoUpdater.Synchronous = true;
AutoUpdater.Mandatory = true;
AutoUpdater.UpdateMode = Mode.Forced;
我的更新.xml:
<?xml version="1.0" encoding="utf-8" ?>
<item>
<version>1.0.1.2</version>
<url>\\SERVER\foo\bar\setup.msi</url>
<mandatory>true</mandatory>
</item>
我的部署项目设置:
DetectNewerInstalledVersion = False
RemovePreviousVersions = True
Version = 1.0.1.2
我的 AssemblyInfo.cs:
[assembly: AssemblyVersion("1.0.1.2")]
[assembly: AssemblyFileVersion("1.0.1.2")]
我更改设置版本(生成新的 ProductCode)以匹配 AssemblyVersion 和 AssemblyFileVersion。但是,当它进行更新时,它只提供修复或删除当前安装的选项。继续“修复”实际上不会更新程序。下次启动程序时,它仍然在旧版本上,并会要求再次更新。
UpgradeCode 保持不变。将 DetectNewerInstalledVersion 设置为 true 会导致 Windows 抛出错误“已安装旧版本”,但我试图使用户不必为每个更新卸载并重新安装。
我能做些什么来解决这个问题?
解决方案
lblVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
AutoUpdater.DownloadPath = System.IO.Path.GetTempPath() + "\\UpdateExtrator\\";
//AutoUpdater.InstallationPath = Application.StartupPath;
AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
AutoUpdater.ReportErrors = true;
AutoUpdater.UpdateMode = Mode.Forced;
AutoUpdater.RunUpdateAsAdmin = true;
推荐阅读
- sas - Proc sql如何使用生日提取大于18yrs的成员记录
- python - 从文件路径中提取“时间”
- javascript - 在字符串中格式化日期
- python - 如何将具有相等相邻条目的数组中的所有条目“归零”?
- r - R FlexDashboard 上的多个可视化(Leafletlet 和 Plotly)之间的交互性
- security - 无法在 IIS 8 上访问 HTTPS 站点
- sql - 无法使用 Formik 对 SQL 数据库执行 POST 功能?
- python - 如何通过主要 canny 边缘裁剪图像
- reactjs - this.props.history.push 在 onChange 方法中不起作用
- java - 运行“flutter build apk --release”时出错