我有一个WIX安装程序自定义BA。在它里面我有2个按钮。在click事件处理程序中,我设置了一些变量,因此我只能确定需要安装的产品的哪些功能。当我执行InstallCommand时,它不会启动安装,而是日志说取消...
我的代码是......
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();
}
日志显示......
[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
为什么安装不启动?它是通常绑定到按钮并且将开始安装的相同命令。
我可以执行以下行并且可行,但我不想重复代码。
model.PlanAction(Microsoft.Tools.WindowsInstallerXml.Bootstrapper.LaunchAction.Install);
谢谢,
加里