static void InjectProductActivationDialog(Project project) { //Injects CLR dialog CustomDialog between MSI dialogs LicenseAgreementDlg and InstallDirDlg. //Passes custom action ShowProductActivationDialog for instantiating and popping up the CLR dialog. //This is practically a full equivalent of the WixSharp.CommonTasks.Tasks.InjectClrDialog(this Project project,...) extension method, //except it places and additional LicenseAccepted condition ManagedAction customDialog = new ShowClrDialogAction("ShowProductActivationDialog"); project.Actions = project.Actions.Add(customDialog); project.UI = WUI.WixUI_Common; var customUI = new CommomDialogsUI(); var prevDialog = Dialogs.LicenseAgreementDlg; var nextDialog = Dialogs.InstallDirDlg; //disconnect prev and next dialogs customUI.UISequence.RemoveAll(x => (x.Dialog == prevDialog && x.Control == Buttons.Next) || (x.Dialog == nextDialog && x.Control == Buttons.Back)); //create new dialogs connection with showAction in between customUI.On(prevDialog, Buttons.Next, new ExecuteCustomAction(customDialog.Id)); customUI.On(prevDialog, Buttons.Next, new ShowDialog(nextDialog, Condition.ClrDialog_NextPressed + " AND LicenseAccepted = \"1\"")); customUI.On(prevDialog, Buttons.Next, new CloseDialog("Exit", Condition.ClrDialog_CancelPressed) { Order = 2 }); customUI.On(nextDialog, Buttons.Back, new ExecuteCustomAction(customDialog.Id)); customUI.On(nextDialog, Buttons.Back, new ShowDialog(prevDialog, Condition.ClrDialog_BackPressed)); project.CustomUI = customUI; }
public static void Main(string[] args) { string projectName = args[0]; string projectNameExe = projectName + ".exe"; string projectFolder = args[1]; string binaryFolder = projectFolder + @"\" + projectName + @"\bin\Release\"; string assemblyPath = binaryFolder + projectNameExe; FileVersionInfo assemblyInfo = FileVersionInfo.GetVersionInfo(assemblyPath); Version version = new Version(assemblyInfo.FileVersion); Console.WriteLine("Project name: " + projectName); Console.WriteLine("Project folder: " + projectFolder); Console.WriteLine("Binary folder: " + binaryFolder); Console.WriteLine("Assembly path: " + assemblyPath); Console.WriteLine("Version: " + version.ToString()); Console.WriteLine("Manufacturer: " + assemblyInfo.CompanyName); Project project = new Project(projectName + "_" + version.ToString(), new Dir(new Id("INSTALL_DIR"), @"%ProgramFiles%\" + projectName, new Files(binaryFolder + "*.exe"), new Files(binaryFolder + "*.exe.config"), new Files(binaryFolder + "*.dll"), new Dir(@"%ProgramMenu%\" + projectName, new ExeFileShortcut(projectName, "[INSTALL_DIR]" + projectNameExe, ""), new ExeFileShortcut("Uninstall " + projectName, "[System64Folder]msiexec.exe", "/x [ProductCode]") ), new Dir(@"%Startup%\", new ExeFileShortcut(projectName, "[INSTALL_DIR]" + projectNameExe, "") ) ) ); project.Version = version; project.GUID = new Guid("54f5a0b8-6f60-4a70-a095-43e2b93bc0fe"); //project.SetNetFxPrerequisite("NETFRAMEWORK45 >='#378389'", "Please install .Net 4.5 first"); //project.ControlPanelInfo.ProductIcon = projectFolder + @"\" + projectName + @"\Resources\trafficlights.ico"; project.ControlPanelInfo.NoModify = true; project.ControlPanelInfo.Manufacturer = assemblyInfo.CompanyName; project.UI = WUI.WixUI_Common; var customUI = new CommomDialogsUI(); var prevDialog = Dialogs.WelcomeDlg; var nextDialog = Dialogs.VerifyReadyDlg; customUI.UISequence.RemoveAll(x => (x.Dialog == prevDialog && x.Control == Buttons.Next) || (x.Dialog == nextDialog && x.Control == Buttons.Back)); customUI.On(prevDialog, Buttons.Next, new ShowDialog(nextDialog)); customUI.On(nextDialog, Buttons.Back, new ShowDialog(prevDialog)); project.CustomUI = customUI; Compiler.BuildMsi(project); }
public static CustomUI InjectPostLicenseClrDialog(string showAction, string clrDialogGoNextCondition = null) { var customUI = new CommomDialogsUI(); var prevDialog = Dialogs.LicenseAgreementDlg; var nextDialog = Dialogs.InstallDirDlg; //disconnect prev and next dialogs customUI.UISequence.RemoveAll(x => (x.Dialog == prevDialog && x.Control == Buttons.Next) || (x.Dialog == nextDialog && x.Control == Buttons.Back)); //create new dialogs connection with showAction in between customUI.On(prevDialog, Buttons.Next, new ExecuteCustomAction(showAction)); customUI.On(prevDialog, Buttons.Next, new ShowDialog(nextDialog, Condition.ClrDialog_NextPressed + " AND " + (clrDialogGoNextCondition ?? "\"1\""))); customUI.On(prevDialog, Buttons.Next, new CloseDialog("Exit", Condition.ClrDialog_CancelPressed) { Order = 2 }); customUI.On(nextDialog, Buttons.Back, new ExecuteCustomAction(showAction)); customUI.On(nextDialog, Buttons.Back, new ShowDialog(prevDialog, Condition.ClrDialog_BackPressed)); return customUI; }