由Wix Sharp创建自动更新

问题描述 投票:0回答:1

我有一个使用Wix Sharp创建的安装程序。有时应用程序必须更新,对我来说找到方法是很重要的。我认为最好的方法是创建一个应用程序“App updater”,它将检查应用程序的版本,如果有新版本,它将下载并安装它。如何使用Wix Sharp创建更新程序.msi?我必须在哪里上传我的.msi更新程序才能通过“应用程序更新程序”进行检查?这是代码:

    static void Main()
    {


        var project = new ManagedProject("MyProduct",
                         new Dir(@"%ProgramFiles%\My Company\My Product",
                             new Files(@"C:\Users\1\source\repos\ParentControl\ParentsControl\*.*")));

        project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");

        project.ManagedUI = ManagedUI.Empty;    //no standard UI dialogs
        project.ManagedUI = ManagedUI.Default;  //all standard UI dialogs

        //custom set of standard UI dialogs
        project.ManagedUI = new ManagedUI();

        project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
                                        .Add(Dialogs.Licence)
                                        .Add(Dialogs.SetupType)
                                        .Add(Dialogs.Features)
                                        .Add(Dialogs.InstallDir)
                                        .Add(Dialogs.Progress)
                                        .Add(Dialogs.Exit);

        project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
                                       .Add(Dialogs.Features)
                                       .Add(Dialogs.Progress)
                                       .Add(Dialogs.Exit);

        project.Load += Msi_Load;
        project.BeforeInstall += Msi_BeforeInstall;
        project.AfterInstall += Msi_AfterInstall;

        //project.SourceBaseDir = "<input dir path>";
        //project.OutDir = "<output dir path>";

        project.BuildMsi();
    }

    static void Msi_Load(SetupEventArgs e)
    {
        if (e.IsUninstalling)
        {
            var w = new Ask();
            if(w.ShowDialog()!=DialogResult.Yes)
            {
                MessageBox.Show("Bad password!");
                e.Result = ActionResult.SkipRemainingActions;
            }

        }
        if (!e.IsUISupressed && !e.IsUninstalling)
            MessageBox.Show(e.ToString(), "Load");

    }

    static void Msi_BeforeInstall(SetupEventArgs e)
    {
        if (!e.IsUISupressed && !e.IsUninstalling)
            MessageBox.Show(e.ToString(), "BeforeInstall");
    }

    static void Msi_AfterInstall(SetupEventArgs e)
    {
        if (!e.IsUISupressed && !e.IsUninstalling)
            MessageBox.Show(e.ToString(), "AfterExecute");

    }
c# wix windows-installer auto-update wixsharp
1个回答
0
投票

你有没有看过为你的应用添加更新? wyupdate https://wyday.com/wyupdate/处理检测更新,下载并重新启动您的应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.