WiX: how to access / change installation directory in managed bootstrapper?

后端 未结 3 1525
余生分开走
余生分开走 2021-01-13 03:28

I am creating a WPF setup application with a custom user interface. I started with the tutorial of Bryan P. Johnston: http://bryanpjohnston.com/2012/09/28/custom-wix-managed

相关标签:
3条回答
  • 2021-01-13 03:38

    One missing property "Type" on Bundle Variable element. caverman_dick is right but this not works properly when not overridable. You can try this too, setting Type="string".

    Wix Variable Element

    <Wix>...<Bundle>...
      <Variable Name="MyApplicationMsiInstallFolder" Value="[WindowsVolume]MyApplication"
              bal:Overridable="yes" Type="string"/>
        <Chain>
            <?if $(var.DbVersion) = false?>
            <PackageGroupRef Id="AccessDatabaseGroup"/>
            <RollbackBoundary />
            <?endif?>
            <MsiPackage Id="MyApplicationMsiPackage" SourceFile="$(var.MyApplicationSetup.TargetPath)" DisplayInternalUI="no"
                                    Vital="yes" >
                <MsiProperty Name="APPLICATIONFOLDER" Value="[MyApplicationMsiInstallFolder]"/>
            </MsiPackage>
        </Chain>
    </Bundle></Wix>
    
    0 讨论(0)
  • 2021-01-13 03:42

    I also use this legendary tutorial. I wanted to use veriable for something else. Namely, the variable says whether the program should be installed. The problem is that the variable does not overwrite when invoke it in InstallExecute(). For my problem it work in this way:

      protected override void Run()
        {
            this.Engine.Log(LogLevel.Verbose, "Launching custom TestBA UX");
            BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
    
    
            MainViewModel viewModel = new MainViewModel(this);
            viewModel.Bootstrapper.Engine.Detect();
    
            MainView view = new MainView();
            this.Engine.StringVariables["SqlStatus"] = view.CheckInstalledSQL() == true ? "true" : "false";
            this.Engine.StringVariables["SsmsStatus"] = view.CheckInstalledSSMS() == true ? "true" : "false";
            view.DataContext = viewModel;
            view.Closed += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
            view.Show();
            Dispatcher.Run();
    
            this.Engine.Quit(0);
        }
    

    Bootstrapper:

    <Variable Name="SqlStatus" bal:Overridable="yes" Value="false" Type="string"/>
    <Variable Name="SsmsStatus" bal:Overridable="yes" Value="false" Type="string"/>
    ...
    
    <ExePackage Id="SSMS" Name="SQLServerManagementStudio" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
        InstallCommand="/install /Passive SSMSInstallRoot=C:\\Program Files\\Microsoft SQL Server /norestart"
        SourceFile="C:\Users\..\Downloads\SSMS-Setup-ENU.exe"
        DetectCondition="SsmsStatus = &quot;true&quot;"/>
    
    0 讨论(0)
  • 2021-01-13 03:45

    Yes just create a variable in your burn bootstrapper:

    <Variable Name="BurnVariable"
              bal:Overridable="yes" />
    

    you can then pass this as a parameter to your boot-strapped msi package:

    <MsiPackage SourceFile="$(var.YourMsiProject.Installer.TargetPath)" Compressed="no">
        <MsiProperty Name="INSTALLLOCATION" Value="[BurnVariable]" />          
    </MsiPackage>
    
    0 讨论(0)
提交回复
热议问题