2013-05-14 160 views
0

我正在使用WiX 3.7的GenerateBootstrapper來生成我在Visual Studio部署項目中使用的引導程序。遞歸地打開WiX引導程序

我的Bundle.wxs目前是一個鏈接與單個項目,引用我的MSI文件。

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

我修改了我的Bootstrapper項目的.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時,我簡要地看到一個對話框,指示'setup正在初始化組件',並且它隱藏起來,並且具有相同事物的新窗口正在打開。不知何故,安裝文件遞歸調用自己,我不能確定爲什麼。看看我的install.log,似乎執行了所有先決條件的檢查,使用SQL Server完成,並確定不需要安裝任何設備(對於我的開發計算機爲true),然後再次調用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這是造成這種情況?我試圖按照How to use Wix to create Windows Installer files ?的例子。

+1

GenerateBootstrapper任務是一個MSBuild任務,用於創建與WiX引導程序完全不同的引導程序。儘管這裏不一定是你的主要問題,但從它看起來,你正在MSBuild中創建一個引導程序,啓動WiX引導程序,啓動安裝程序。 – BryanJ 2013-05-14 14:44:53

回答

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文件?