SymphonyElectron/installer/win/WixSharpToolset/Samples/MajorUpgrade/setup.1.cs
2020-08-21 08:25:55 +02:00

37 lines
1.2 KiB
C#

//css_dir ..\..\;
//css_ref Wix_bin\SDK\Microsoft.Deployment.WindowsInstaller.dll;
//css_ref System.Core.dll;
using System;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
using WixSharp;
using WixSharp.CommonTasks;
class Script
{
static public void Main()
{
var project =
new ManagedProject("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"Files\1\MyApp.exe"),
new File(@"Files\1\MyApp.cs"),
new File(@"Files\1\readme.txt")));
project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
project.Version = new Version("1.0.709.10040");
project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize;
project.BeforeInstall += project_BeforeInstall;
project.PreserveTempFiles = true;
Compiler.BuildMsi(project, "setup.1.msi");
}
static void project_BeforeInstall(SetupEventArgs e)
{
MessageBox.Show(e.ToString(), "BeforeInstall " + AppSearch.GetProductVersionFromUpgradeCode(e.UpgradeCode));
}
}