Question

I'm using WiX 3.7's GenerateBootstrapper to generate bootstrappers that I've used in a Visual Studio deployment project.

My Bundle.wxs is currently a chain with a single item, referencing my MSI file.

<Chain>
    <MsiPackage Id="MyProgramInstaller" SourceFile="$(var.MyProgramInstaller.TargetPath)" Compressed="no"/>
</Chain>

I modified my Bootstrapper project's .wixproj to include the bootstrapper generation of various components.

...
    <ItemGroup>
        <ProjectReference Include="..\MyProgramInstaller\MyProgramInstaller.wixproj">
            <Name>MyProgramInstaller</Name>
            <Project>{my-guid}</Project>
            <Private>True</Private>
            <DoNotHarvest>True</DoNotHarvest>
            <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
            <RefTargetDir>INSTALLFOLDER</RefTargetDir>
        </ProjectReference>
    </ItemGroup>

    <ItemGroup>
        <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1">
            <ProductName>.NET Framework 3.5 SP1</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include=".NETFramework,Version=v4.0">
            <ProductName>.NET Framework 4.0</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">
            <ProductName>Windows Installer 3.1</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Windows.Installer.4.5">
            <ProductName>Windows Installer 4.5</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Sql.Server.Express.10.50.1600.1">
            <ProductName>Microsoft SQL Server 2008 R2</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Windows.Imaging.Component">
            <ProductName>Windows Imaging Component</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="WindowsXP-KB921337-x86-ENUWinXPSP2">
            <ProductName>Win XP SP2 Hotfix</ProductName>
        </BootstrapperFile>
    </ItemGroup>

    <Import Project="$(WixTargetsPath)" />
    <!--
      To modify your build process, add your task inside one of the 
      targets below and uncomment it.
      Other similar extension points exist, see Wix.targets.

      <Target Name="BeforeBuild">
      </Target> -->

      <Target Name="AfterBuild">
          <GenerateBootstrapper ApplicationFile="$(TargetFileName)"
                        ApplicationName="My Program"
                        BootstrapperItems="@(BootstrapperFile)"
                        ComponentsLocation="Relative"
                        CopyComponents="True"
                        OutputPath="$(OutputPath)"
                        Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\" />
      </Target>

When I build the bundle project, I see my MSI, EXE, and folders of my prerequisite packages as expected. When I go to execute my bootstrapper exe, I briefly see a dialog indicating that 'setup is initializing components', and it is hidden and a new window with the same thing is opening up. Somehow, the setup file is recursively calling itself, and I can't determine why. Looking at my install.log, it seems that the check for all of my prerequisites execute, finishing with SQL Server, and determining that nothing needs to be installed (true for my development machine), and then calling setup.exe again. This doesn't stop until I close out the setup window quickly enough to abort the next call. It should be trying to call the .msi file again, not the setup.exe, but I'm not sure what's causing this behavior.

Result of running operator 'ValueEqualTo' on property 'SQLExpressChk' and value '-2': false
Result of running operator 'ValueEqualTo' on property 'SQLExpressChk' and value '-3': false
Result of running operator 'ValueEqualTo' on property 'SQLExpressChk' and value '-4': false
Result of running operator 'ValueLessThan' on property 'SQLExpressChk' and value '-4': false
Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'amd64': false
Result of running operator 'ValueNotEqualTo' on property 'SQLExpressChk' and value '1': true
Result of checks for command 'SqlExpress2008_R2\SQLEXPR_x64_ENU.EXE' is 'Bypass'
Running checks for command 'SqlExpress2008_R2\SQLEXPR32_x86_ENU.EXE'
Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'amd64': false
Result of running operator 'ValueNotEqualTo' on property 'SQLExpressChk' and value '2': true
Result of checks for command 'SqlExpress2008_R2\SQLEXPR32_x86_ENU.EXE' is 'Bypass'
'SQL Server 2008 R2 Express' RunCheck result: No Install Needed
Launching Application.
Running command 'C:\Path\To\MyBootstrapper\bin\Release\setup.exe' with arguments ''

Is there something in my GenerateBootstapper that's causing this? I attempted to follow the example from How to use Wix to create Windows Installer files ?.

Was it helpful?

Solution

The answer lies in the <GenreateBootsrapper> tag.

The ApplicationFile attribute is referring to the MSI file. $(TargetFileName), which is what I was using originally, must inflate to the setup.exe, causing it to recursively execute.

   <Target Name="AfterBuild">
        <GenerateBootstrapper 
             ApplicationFile="MyInstaller.msi"
             ApplicationName="My Program"
             BootstrapperItems="@(BootstrapperFile)" 
             ComponentsLocation="Relative" 
             CopyComponents="True" 
             OutputPath="$(OutputPath)" 
             Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\" />   
    </Target>

However, how do I to get the bootstrapper to target the MSI file by variable name in this file?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top