using System; using WixSharp; using WixSharp.Bootstrapper; using WixSharpSetup.Dialogs; using io = System.IO; namespace WixSharpSetup { class Program { staticvoid Main() { var mainAppMsi = BuildMainAppInstallerMsi(); // Bootstrapper won't display managed UI... BuildBootstrapperExe(mainAppMsi); } staticvoid BuildBootstrapperExe(string mainAppMsi) { var bootstrapper = new Bundle("MyPrereqs" , new PackageGroupRef("NetFx40Web") , new MsiPackage(mainAppMsi) { DisplayInternalUI = true } ); bootstrapper.Version = new Version("1.0.0.0"); bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25844b"); bootstrapper.Application = new SilentBootstrapperApplication(); bootstrapper.PreserveTempFiles = true; var bootstrapperExe = io.Path.ChangeExtension(mainAppMsi, ".exe"); bootstrapper.Build(bootstrapperExe); } staticstring BuildMainAppInstallerMsi() { var project = new ManagedProject("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File("Program.cs"))); project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b"); //custom set of standard UI dialogs project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add<WelcomeDialog>() .Add<LicenceDialog>() .Add<SetupTypeDialog>() .Add<FeaturesDialog>() .Add<InstallDirDialog>() .Add<ProgressDialog>() .Add<ExitDialog>(); project.ManagedUI.ModifyDialogs.Add<MaintenanceTypeDialog>() .Add<FeaturesDialog>() .Add<ProgressDialog>() .Add<ExitDialog>(); //project.SourceBaseDir = "<input dir path>";//project.OutDir = "<output dir path>"; ValidateAssemblyCompatibility(); return project.BuildMsi(); } staticvoid ValidateAssemblyCompatibility() { var assembly = System.Reflection.Assembly.GetExecutingAssembly(); if (!assembly.ImageRuntimeVersion.StartsWith("v2.")) { Console.WriteLine("Warning: assembly '{0}' is compiled for {1} runtime, which may not be compatible with the CLR version hosted by MSI. " + "The incompatibility is particularly possible for the EmbeddedUI scenarios. " + "The safest way to solve the problem is to compile the assembly for v3.5 Target Framework.", assembly.GetName().Name, assembly.ImageRuntimeVersion); } } } }
↧
New Post: UI is not displayed when I combine a ManagedUI MSI with a Bundle bootstrapper
↧