0

我正在使用 WiX 3.7 的 GenerateBootstrapper 来生成我在 Visual Studio 部署项目中使用过的引导程序。

Bundle.wxs目前是一个包含单个项目的链,引用我的MSI文件。

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

我修改了我的引导程序项目的 .wixproj 以包含各种组件的引导程序生成。

...
    <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>

当我构建捆绑项目时,我看到了我的 MSI、EXE 和我的必备软件包的文件夹,如预期的那样。当我去执行我的引导程序 exe 时,我短暂地看到一个对话框,指示“安装程序正在初始化组件”,它被隐藏了,并且打开了一个具有相同内容的新窗口。不知何故,安装文件递归地调用自己,我无法确定原因。查看我的install.log,似乎执行了对我所有先决条件的检查,完成了 SQL Server,并确定不需要安装任何东西(对于我的开发机器来说是这样),然后setup.exe再次调用。这不会停止,直到我足够快地关闭设置窗口以中止下一个呼叫。它应该尝试再次调用 .msi 文件,而不是 setup.exe,但我不确定是什么导致了这种行为。

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 ''

我有什么东西GenerateBootstapper导致了这个吗?我试图按照如何使用 Wix 创建 Windows Installer 文件中的示例进行操作?.

4

1 回答 1

0

答案在于<GenreateBootsrapper>标签。

ApplicationFile 属性是指 MSI 文件。$(TargetFileName),这是我最初使用的,必须膨胀到setup.exe,导致它递归执行。

   <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>

但是,如何让引导程序通过此文件中的变量名来定位 MSI 文件?

于 2013-05-14T13:42:23.677 回答