The engine runs asynchronously on a separate thread. Try removing the this.Close and see if it works.
-----Original Message----- From: garymonk [mailto:g...@gurudental.com] Sent: Tuesday, August 12, 2014 10:21 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Cannot execute the ICommand InstallCommand in C# code behind I have a WIX installer custom BA. In it I have 2 buttons. In the click event handlers I set some variables so I can only determine which features of the product I need to install. When I execute the InstallCommand it doesn't start the install, instead the log says canceling... My code is... this.InstallCommand = new DelegateCommand(() => this.model.PlanAction(LaunchAction.Install), () => this.State == InstallState.NotPresent); public InstallView(InstallViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; this.viewModel = viewModel; model = viewModel.model; this.Closed += (sender, e) => viewModel.CancelCommand.Execute(this); } private void btnInstallClientOnly_Click(object sender, RoutedEventArgs e) { model.SetInstallClient("InstallClient", 1); model.SetInstallServer("InstallServer", 0); if (viewModel.InstallCommand.CanExecute(null)) { model.LogMessage("Executing Install Command"); viewModel.InstallCommand.Execute(null); } this.Close(); } This is the log output... [0F60:0E34][2014-08-11T15:02:01]i001: Burn v3.8.1128.0, Windows v6.1 (Build 7601: Service Pack 1), path: J:\Software\Gurusetup.exe, cmdline: '-l installer.txt -burn.unelevated BurnPipe.{A1F2A561-63B7-4764-9287-A49EC349D6B5} {80E463D6-6AA5-43A2-9B39-7AA6705242A8} 4932' [0F60:0E34][2014-08-11T15:02:01]i000: Setting string variable 'WixBundleLog' to value 'J:\Software\installer.txt' [0F60:0E34][2014-08-11T15:02:01]i000: Setting string variable 'WixBundleOriginalSource' to value 'J:\Software\Gurusetup.exe' [0F60:0E34][2014-08-11T15:02:01]i000: Setting string variable 'WixBundleName' to value 'Guru' [0F60:0E34][2014-08-11T15:02:01]i000: Loading managed bootstrapper application. [0F60:0E34][2014-08-11T15:02:01]i000: Creating BA thread to run asynchronously. [0F60:0E34][2014-08-11T15:02:02]i100: Detect begin, 2 packages [0F60:0E34][2014-08-11T15:02:02]i102: Detected related bundle: {0d2675f0-1921-40ff-9a7b-83c2ad0886d2}, type: Upgrade, scope: PerMachine, version: 6.0.4.0, operation: None [0F60:0E34][2014-08-11T15:02:02]i101: Detected package: SQLBundle, state: Absent, cached: None [0F60:0E34][2014-08-11T15:02:02]i101: Detected package: Client, state: Present, cached: None [0F60:0E34][2014-08-11T15:02:02]i199: Detect complete, result: 0x0 [0F60:1040][2014-08-11T15:02:04]i000: Setting numeric variable 'InstallClient' to value 1 [0F60:1040][2014-08-11T15:02:04]i000: Setting numeric variable 'InstallServer' to value 0 [0F60:1040][2014-08-11T15:02:04]i000: Executing Install Command [0F60:1040][2014-08-11T15:02:04]i000: Canceling... [0F60:0E34][2014-08-11T15:02:04]i500: Shutting down, exit code: 0x0 [0F60:0E34][2014-08-11T15:02:04]i410: Variable: InstallClient = 1 [0F60:0E34][2014-08-11T15:02:04]i410: Variable: InstallServer = 0 [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleAction = 4 [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleElevated = 1 [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleLog = J:\Software\installer.txt [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleManufacturer = Guru Dental [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleName = Guru [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleOriginalSource = J:\Software\Gurusetup.exe [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleProviderKey = {08b31e02-bca5-4816-88fb-56ba0d62a692} [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleTag = [0F60:0E34][2014-08-11T15:02:04]i410: Variable: WixBundleVersion = 6.0.4.0 [0F60:0E34][2014-08-11T15:02:04]i007: Exit code: 0x0, restarting: No Why doesn't the install start? It is the same command that would normally be bound to a button and that would start the install. I could execute the following line and that works, but I would prefer not to duplicate code. model.PlanAction(Microsoft.Tools.WindowsInstallerXml.Bootstrapper.LaunchAction.Install); Thank you, Gary -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Cannot-execute-the-ICommand-InstallCommand-in-C-code-behind-tp7596330.html Sent from the wix-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users