5

一段时间以来,我一直在使用 Squirrel.Windows 成功部署 WPF。我对我的机器进行了重新映像,并且RELEAESES文件Releases夹中的文件是从头开始重新创建的,因为我将这个文件夹完全排除在我的.gitignore. 这似乎破坏了在我重新映像之前创建的版本上用户的自动更新功能。

我可以在RELEASES文件中设置什么来强制旧版本在不重新创建所有 nuget 包的情况下引入更新的版本吗?

RELEASES这是我文件的相关部分。该版本2.0.6121.16815的用户不会自动迁移到底部的较新版本。

发布文件

这是我的更新程序代码app.xaml.cs。不确定它是否相关,因为它在技术上运行良好。

Task.Run(async () =>
                {
                    using (var mgr = new UpdateManager(updatePath, packageName))
                    {    
                        var updates = await mgr.CheckForUpdate();
                        if (updates.ReleasesToApply.Any())
                        {
                            try
                            {
                                var lastVersion = updates.ReleasesToApply.OrderBy(x => x.Version).Last();

                                await mgr.DownloadReleases(updates.ReleasesToApply);
                                await mgr.ApplyReleases(updates);

                                try
                                {
                                    latestExe = Path.Combine(mgr.RootAppDirectory, string.Concat("app-", lastVersion.Version), "App.exe");
                                    log.Debug("Latest exe:" + latestExe);
                                    mgr.CreateShortcutsForExecutable(latestExe, DefaultLocations, false);
                                }
                                catch(Exception ex)
                                {
                                    log.Error("error creating shortcuts for executable",ex);

                                }
                                restart = true;
                            }
                            catch(Exception ex)
                            {
                                log.Error("Error pulling in updated files", ex);
                            }
                        }
                        else
                        {
                            //No updates
                            log.Debug("No updates available");
                        }
                    }

                    if (restart)
                    {
                        log.Debug("Updated App. Restarting...");
                        UpdateManager.RestartApp(latestExe);

                    }

                }).Wait(); 
4

0 回答 0