I have an installer created using Wix Sharp. Sometimes the application has to be updated, and it is important for me to find the way to do it. I think that the best way is to create one more app "App updater", which will check the version of the application, and if there is a new version it will download and install it. How can I create updater .msi using Wix Sharp? And where do I have to upload my .msi updater to be checked by the "App updater"? Here is the code:
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");
}