如何将参数传递给BootstrapperFile?

时间:2014-09-26 15:06:18

标签: .net wix installer windows-installer bootstrapper

我的引导程序setup.exe生成如下(摘录自我的.wixproj文件):

<Target Name="AfterBuild">
  <ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1">
      <ProductName>.NET Framework 3.5 SP1</ProductName>
    </BootstrapperFile>
    <BootstrapperFile Include="Microsoft.VSTORuntime.4.0">
      <ProductName>Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)</ProductName>
    </BootstrapperFile>
  </ItemGroup>
  </BootstrapperFile>
  <GenerateBootstrapper ApplicationFile="$(TargetFileName)" ApplicationName="My Application" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="HomeSite" CopyComponents="False" OutputPath="$(OutputPath)" Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\BootStrapper" ApplicationRequiresElevation="True" Culture="en-US" Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
</Target>

msiexec支持/norestart,我希望将此/norestart参数传递给这些先决条件,例如Office Runtime和.NET 3.5安装程序。我不知道如何将命令行参数传递给引导程序将下载和安装的这些MSI。有没有标准的方法来实现这个目标?

1 个答案:

答案 0 :(得分:2)

在默认的bootstrapper中,这是我们从命令行传递参数的方式:

<Wix>
  <Bundle> 
    <Variable Name="CommandLineArgument" bal:Overridable="yes"/>
    <Chain>
      <MsiPackage>
        <MsiProperty Name="CommandLineArgument" Value="[CommandLineArgument]"/>
      </MsiPackage>
    </Chain>
  </Bundle>
</Wix>

记下BAL:Overridable。这就是我如何确保我们可以从命令行传递属性值。确保将名称空间声明添加到Wix元素xmlns:bal =&#34; http://schemas.microsoft.com/wix/BalExtension",并链接到WixBalExtension.dll。