找出为啥 Wix Bootstrapper 构建了一个“无效”的 MSI

Posted

技术标签:

【中文标题】找出为啥 Wix Bootstrapper 构建了一个“无效”的 MSI【英文标题】:Find out why Wix Bootstrapper has build an MSI that is "Invalid"找出为什么 Wix Bootstrapper 构建了一个“无效”的 MSI 【发布时间】:2016-05-31 13:10:22 【问题描述】:

我是 Wix 的新手,我的问题并不是我该如何解决这个特定问题,而是我该如何解决根源问题?你会采取什么步骤来“调试”这个?

考虑到这一点,这是我当前的问题:

每当我尝试打开引导程序构建的 MSI 时,我都会得到:

我该如何解决导致这种情况的根源??

构建的输出是:

Build started 31/05/2016 14:00:50.
Project "C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build" on node 1 (Bundle target(s)).
Bundle:
  TEST: ClientInstaller.wxs;WebSiteContent.wxs;IISConfiguration.wxs
  "C:\Program Files (x86)\WiX Toolset v3.10\bin\candle" -ext WixBalExtension -ext WixNetFxExtension  -ext WixUtilExtension  "..\MyProjBootStrapper\Bundle.wxs"  -dpub
  lishDir=..\Setup\publish\
  Windows Installer XML Toolset Compiler version 3.10.3.2924
  Copyright (c) .NET Foundation and contributors. All rights reserved.

  Bundle.wxs
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/q' when the ExePacka ge/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/q' when the ExePa ckage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/norestart' when the
ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/norestart' when t he ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/chainingpackage' whe n the ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/chainingpackage'
when the ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  "C:\Program Files (x86)\WiX Toolset v3.10\bin\light" "Bundle.wixobj"  -ext WixBalExtension -ext WixNetFxExtension -ext WixUtilExtension   -out bin\Release\Setup.
  msi
  Windows Installer XML Toolset Linker version 3.10.3.2924
  Copyright (c) .NET Foundation and contributors. All rights reserved.

C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\Bundle.wixobj : warning LGHT1109: Found mismatched entry point <Bundle>. Expected <Product> for specified output pack age type .msi. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  Install package has been created.
Done Building Project "C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build" (Bundle target(s)).


Build succeeded.

"C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build" (Bundle target) (1) ->
(Bundle target) ->
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/q' when the ExePac kage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/q' when the Exe Package/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/norestart' when th e ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/norestart' when  the ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@RepairCommand attribute value '' should contain '/chainingpackage' w hen the ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjBootStrapper\Bundle.wxs(31): warning CNDL1136: The ExePackage/@UninstallCommand attribute value '' should contain '/chainingpackage ' when the ExePackage/@Protocol attribute is set to 'netfx4'. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]
  C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\Bundle.wixobj : warning LGHT1109: Found mismatched entry point <Bundle>. Expected <Product> for specified output pa ckage type .msi. [C:\MyProj\MyProj\src\MyProj.Net\MyProjClientInstaller\setup.build]

    7 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.32

所以警告,但似乎没有表明安装程序错误?特别是因为我现在已经取出了 .net 的东西:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <Bundle Name="MyBootStrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="71d3e0df-abd8-450e-a8e0-ade54891fc4f">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

        <Chain>
            <!-- TODO: Define the list of chained packages. -->
            <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
      <!--<PackageGroupRef Id="Netfx4Full"/>-->
      <MsiPackage Id="ClientInstaller" SourceFile="..\MyClientInstaller\bin\Release\ClientSetup.msi" />
        </Chain>
    </Bundle>
  <Fragment>
    <!-- Check for .NET 4.0-->    
    <util:RegistrySearch Root="HKLM"
                         Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                         Value="Version"
                         Variable="Netfx4FullVersion"
                  />
    <util:RegistrySearch Root="HKLM"
                         Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                         Value="Version"
                         Variable="Netfx4x64FullVersion"
                  />
    <PackageGroup Id ="Netfx4Full">
      <ExePackage Id="Netfx4Full"
                  DisplayName="Microsoft .Net Framework"
                  Cache="yes"
                  Compressed="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile="redist\dotNetFx40_Full_x86_x64.exe"
                  InstallCommand="/passive /norestart /q /chainingpackage"
                  DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)"
                  />


    </PackageGroup>
  </Fragment>
</Wix>

我正在使用此命令在 MSBuild 中构建:

<Target Name="Bundle">
    <!--     At last create install bundle-->
    <Message Text="TEST: @(WixCode)"/>
    <Exec
        Command='"$(WixPath)candle" -ext WixBalExtension -ext WixNetFxExtension  -ext WixUtilExtension  "$(BootStrapperPath)Bundle.wxs"  -dpublishDir=$(Publish)'
        ContinueOnError="false"
        WorkingDirectory="." />
    <Exec
        Command='"$(WixPath)light" "Bundle.wixobj"  -ext WixBalExtension -ext WixNetFxExtension -ext WixUtilExtension   -out $(BundleOut)'
        ContinueOnError="false"
        WorkingDirectory="." />


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

我一直认为“燃烧”需要存在于某个地方,但到目前为止我发现的教程似乎不建议......

我也尝试在 Visual Studio 中构建它,我得到了相同的结果(它是一个引导程序模板)

----更新----

如果我将它构建为 .exe 就可以了!

【问题讨论】:

【参考方案1】:

此警告会准确告诉您问题所在

warning LGHT1109: Found mismatched entry point <Bundle>.
                  Expected <Product> for specified output package type .msi.

捆绑包是 exe 安装程序,而不是 MSI。

【讨论】:

所以不可能有一个 MSI 捆绑包?模板的默认目标是 .msi 多么令人困惑!谢谢你:)

以上是关于找出为啥 Wix Bootstrapper 构建了一个“无效”的 MSI的主要内容,如果未能解决你的问题,请参考以下文章

WiX-Bootstrapper - 为 UAC 对话框设置产品名称和公司名称

从 Wix Bootstrapper Bundle 检查文件版本

是否可以使用 wix bootstrapper 自动下载先决条件

自定义 Bootstrapper UI,类似于自定义的 wix UI

如何确定 WIX Bootstrapper 中是不是安装了 dotnet 和 VSTORuntime

WiX Burn Bootstrapper 不调用 OnDetectRelatedBundle