无法打开Wix安装包

时间:2017-02-14 10:10:09

标签: wix bundle bootstrapper

我正在使用Wix捆绑在主.msi安装程序之前安装.net框架版本4.6.1。我正在使用wix工具集3.11,这是最新的每周发布 http://wixtoolset.org/downloads/v3.11.0.1307/wix311.exe

这是文件Bundle.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
    <Bundle Name="RevieweBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="37650dfa-8f11-4934-82fd-f720d95c86d7">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
          <bal:WixStandardBootstrapperApplication
            LicenseFile="License.rtf"
            ShowVersion="yes"
            />
        </BootstrapperApplicationRef>
    <Chain>
            <PackageGroupRef Id="NetFx461Web"/>
            <MsiPackage Id = "Reviewer.Setup" SourceFile="..\ReviewerInstaller\bin\Release\ReviewerInstaller.msi" />
        </Chain>
    </Bundle>
</Wix>

文件ReviewerInstaller.msi是主安装程序。我正在使用灯光和蜡烛来构建安装程序。

&#34; C:\ Program Files(x86)\ WiX Toolset v3.11 \ bin \ candle&#34; -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir = .. \ Reviewer.Web \ bin \ PackageTmp -dMyWebResourceDir =。 Bundle.wxs   Windows Installer XML Toolset编译器版本3.11.0.1307   版权所有(c).NET Foundation和贡献者。保留所有权利。

Bundle.wxs   &#34; C:\ Program Files(x86)\ WiX Toolset v3.11 \ bin \ light&#34; -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out bin \ Release \ ReviewerInstallerPrerequisite.msi Bundle.wixobj   Windows Installer XML工具集链接器版本3.11.0.1307   版权所有(c).NET Foundation和贡献者。保留所有权利。

c:\ Projects \ NewCheckout \ reviewer \ RevieweBootstrapper \ Bundle.wixobj:警告LGHT1109:找到不匹配的入口点。预期指定的输出包类型.msi。 [C:\项目\评\ RevieweBootstrapper \ setup.build]   已创建安装包。 完成建筑项目&#34; c:\ Projects \ reviewer \ RevieweBootstrapper \ setup.build&#34; (WIX目标)。

构建成功。

&#34; C:\项目\评\ RevieweBootstrapper \ setup.build&#34; (WIX目标)(1) - &gt; (WIX目标) - &gt;   c:\ Projects \ reviewer \ RevieweBootstrapper \ Bundle.wixobj:警告LGHT1109:找到不匹配的入口点。预期指定的输出包类型.msi。 [C:\项目\评\ RevieweBootstrapper \ setup.build]

使用上述警告构建成功,但是,当我尝试构建的安装程序时,我收到以下错误

&#34;无法打开此安装包。请与应用程序供应商联系,以验证这是一个有效的Windows安装程序包&#34;

你可以帮我解决这个问题吗?

仅供您参考,主测试器在我测试时工作正常。

这是主安装程序的wxs文件:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="Reviewer" Language="1033" Version="1.0.0.0" Manufacturer="Eurotherm By Schneider-Electric" UpgradeCode="a3f989dc-6e50-4513-a692-09cd080673bc">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />

        <Feature Id="ProductFeature" Title="ReviewerInstaller" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="WebComponents"/>
      <ComponentGroupRef Id="ReviewerIssConfiguration"/>
    </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="CommonAppDataFolder">
                <Directory Id="Company" Name="Eurotherm">
                    <Directory Id="INSTALLFOLDER" Name="Reviewer" />
                </Directory>
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
                <!-- TODO: Insert files, registry keys, and other resources here. -->
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>

主安装程序中引用了另外两个wxs文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
    <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="ReviewerAppPool" Guid="" KeyPath="yes">
        <iis:WebAppPool Id="ReviewerAppPool"
                        Name="Reviewer"
                        Identity="applicationPoolIdentity"
                         ManagedPipelineMode="Integrated" 
                        ManagedRuntimeVersion="v4.0" />
      </Component>

      <Component Id="InstallWebsite" Guid="" KeyPath="yes">
        <!-- Install to default web site -->
        <iis:WebSite Id="ReviewerWebsite" Description='Reviewer' Directory='INSTALLFOLDER' AutoStart='yes' StartOnInstall='yes'>
          <iis:WebAddress Id="AllUnassigned" Port="80" />
          <iis:WebApplication Id="ReviewerApplication" Name="[ReviewerWebsite][WEBSITE_ID]" WebAppPool="ReviewerAppPool"></iis:WebApplication>
        </iis:WebSite>
      </Component>
    </DirectoryRef>

    <ComponentGroup Id="ReviewerIssConfiguration">
      <ComponentRef Id="InstallWebsite" />
      <ComponentRef Id="ReviewerAppPool" />
    </ComponentGroup>
  </Fragment>
</Wix>

使用heat命令填充其他wxs文件(Id =&#34; WebComponents&#34;)

1 个答案:

答案 0 :(得分:2)

我必须将目标指定为&#34; .exe &#34;使用蜡烛和灯光构建安装程序时的扩展名和不是.msi

这是我在setup.build文件中的烛光命令 &#34; $(WixPath)BIN \蜡烛&#34; -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir = $(Publish)-dMyWebResourceDir =。 -dTargetExt = .exe -dTargetFileName = ReviewerInstaller.exe @(WixCode,&#39;&#39;)

这是光命令 &#34; $(WixPath)BIN \光&#34; -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out $(ExeOut)@(WixObject,&#39;&#39;)

变量$(WixPath)在setup.build

中定义

我使用Visual Studio Developer命令提示符中的以下命令构建项目

msbuild /target:WIX setup.build

这里也是我的setup.build

的内容
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build"
       xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebSiteSource>..\DemoWebsite\</WebSiteSource>
    <Publish>..\Reviewer.Web\bin\PackageTmp</Publish>
    <ExeOut>bin\Release\ReviewerInstaller.exe</ExeOut>
    <WixPath>C:\Program Files (x86)\WiX Toolset v3.11\</WixPath>
  </PropertyGroup>

  <!-- The list of WIX input files -->
  <ItemGroup>
    <WixCode Include="Bundle.wxs" />
  </ItemGroup>

  <!-- The list of WIX after candle files -->
  <ItemGroup>
    <WixObject Include="Bundle.wixobj" />
  </ItemGroup>

  <!-- Define creating installer in another target -->
  <Target Name="Harvest">
    <!-- Harvest all content of published result -->
    <Exec
        Command='"$(WixPath)bin\heat" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg WebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
        ContinueOnError="false"
        WorkingDirectory="." />
  </Target>
  <Target Name="WIX">
    <!--     At last create an installer -->
    <Exec
        Command='"$(WixPath)bin\candle" -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=$(Publish) -dMyWebResourceDir=. -dTargetExt=.exe -dTargetFileName=ReviewerInstaller.exe @(WixCode, &apos; &apos;)'
        ContinueOnError="false"
        WorkingDirectory="." />
    <Exec
        Command='"$(WixPath)bin\light" -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out $(ExeOut) @(WixObject, &apos; &apos;)'
        ContinueOnError="false"
        WorkingDirectory="." />

    <!-- A message at the end -->
    <Message Text="Install package has been created." />
  </Target>
</Project>