Wix安装包打不开

Wix Installation package could not be opened

我正在使用 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是主要的安装程序。我正在使用灯和蜡烛来构建安装程序。

"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle" -ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=..\Reviewer.Web\bin\PackageTmp -dMyWebResourceDir=。 Bundle.wxs Windows 安装程序 XML 工具集编译器版本 3.11.0.1307 版权所有 (c) .NET 基金会和贡献者。保留所有权利。

Bundle.wxs "C:\Program Files (x86)\WiX Toolset v3.11\bin\light" -ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out bin\Release\ReviewerInstallerPrerequisite.msi Bundle.wixobj Windows 安装程序 XML 工具集链接器版本 3.11.0.1307 版权所有 (c) .NET 基金会和贡献者。保留所有权利。

c:\Projects\NewCheckout\reviewer\RevieweBootstrapper\Bundle.wixobj:警告 LGHT1109:发现不匹配的入口点。预期用于指定的输出包类型 .msi。 [c:\Projects\reviewer\RevieweBootstrapper\setup.build] 安装包已创建。 完成建筑项目 "c:\Projects\reviewer\RevieweBootstrapper\setup.build"(WIX 目标)。

构建成功。

"c:\Projects\reviewer\RevieweBootstrapper\setup.build"(WIX 目标)(1) -> (WIX 目标)-> c:\Projects\reviewer\RevieweBootstrapper\Bundle.wixobj:警告 LGHT1109:发现不匹配的入口点。预期用于指定的输出包类型 .msi。 [c:\Projects\reviewer\RevieweBootstrapper\setup.build]

构建成功并出现上述警告,但是,当我尝试构建安装程序时,出现以下错误

"This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows installer package"

你能帮我解决这个问题吗?

仅供参考,主安装程序在我测试时工作正常。

这是主安装程序的 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>

另一个 wxs 文件 (Id="WebComponents") 是使用 heat 命令填充的

在使用蜡烛和灯光构建安装程序时,我必须将目标指定为“.exe”扩展名 而不是 .msi

这是我在 setup.build 文件中的蜡烛命令 “$(WixPath)bin\candle”-ext WixBalExtension -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -ext WixNetFxExtension -dpublishDir=$(Publish) -dMyWebResourceDir=。 -dTargetExt=.exe -dTargetFileName=ReviewerInstaller.exe @(WixCode, ' ')

这是灯光命令 “$(WixPath)bin\light”-ext WixBalExtension -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -ext WixSqlExtension -out $(ExeOut) @(WixObject, ' ')

变量 $(WixPath) 在 setup.build

中定义

我在 Visual Studio 开发人员命令提示符

中使用以下命令构建项目
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>