【问题标题】:LGHT0094 : Unresolved reference to symbol 'Component:MsiFilesGroup'LGHT0094:未解决对符号“组件:MsiFilesGroup”的引用
【发布时间】:2020-02-13 13:36:00
【问题描述】:

我需要创建一个用于分发的 MSI,这是旧故事但新情况。我使用 Visual Studio,只使用 Wix 工具集 (3.11.2.4516)。我的文件在 msi 文件夹下:

MyFolder
|
---msi
|  |
|  ---Sample1.txt
|  |
|  ---Sample2.txt
|
---build.bat
|
---Product.wxs

基本上,我确实将 msi 文件夹中的这些文件收集到 msi.wxs 中:

heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs

我得到一个名为 MsiFilesGroup 的 ComponentGroup。主要部分 (Product.wxs) 定义了一个交互式 WixUI,用于在安装过程中指导用户。

这些 Product.wxs 定义了引用上述文件的功能:

<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
         UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
        <Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR" 
            InstallerVersion="200" Compressed="yes" />
        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
        <Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
            <ComponentRef Id="MsiFilesGroup" />
        </Feature>
        <Property Id="SQLCLRTYPES">
            <RegistrySearch Id="SqlClrTypesSearch" Root="HKLM" Type="raw"
                        Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
                        Name="KeyName1"/>
        </Property>
        <Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
        <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
        <Property Id="buttonGroup" Value="1" />
        <UIRef Id="WixUI_InstallDir" />
    </Product>
</Wix>

如果我使用 ComponentRef 进行引用,我会收到此错误:

error LGHT0094 : Unresolved reference to symbol 'Component:MsiFilesGroup' 
    in section 'Product:{B858BC76-AD11-45C3-A300-D1C6B73DFF56}'

如果我使用 ComponentGroup,它会以这种方式失败:

Product.wxs(8) : error CNDL0005 : The Feature element contains an unexpected child element 'ComponentGroup'.
light.exe : error LGHT0103 : The system cannot find the file 'Product.wixobj' with type 'Source'.

任何提示都会有很大帮助。

build.bat 包含对 Wix 命令的调用,如下所示:

@echo off

del *.msi
del *.wix*
del msi.wxs

heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs

candle msi.wxs
candle Product.wxs

light -ext WixUIExtension msi.wixobj Product.wixobj -out Product.msi

【问题讨论】:

    标签: wix windows-installer


    【解决方案1】:

    你缺少的是light.exe命令,还有很多其他的东西需要调整。

    这里有两个稍微修改和简化的批处理和 WiX 源。请注意两个 *.wixobj 文件馈送到 light.exe 和其中添加的 -var var.sourcefolder 以设置源目录:

    建议的“Build.cmd”

    @echo off
    
    heat dir msi -cg MsiFilesGroup -dr INSTALLFOLDER -gg -sfrag -srd -suid -var var.sourcefolder -out msi.wxs
    
    candle -dsourcefolder="msi" msi.wxs >> Build.log
    candle Product.wxs >> Build.log
    
    light -ext WixUIExtension Product.wixobj msi.wixobj -out Product.msi >> Build.log
    
    rem pause
    

    建议(简化)“Product.wxs” - 我发现只有 Mondo 对话框集“独立”工作,无需任何修改或摆弄:

    <?xml version="1.0" encoding="utf-8" ?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
             UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
            <Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR" 
                InstallerVersion="200" Compressed="yes" />
            <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
    
            <Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
                <ComponentGroupRef Id="MsiFilesGroup" />
            </Feature>
    
            <UIRef Id="WixUI_Mondo" />
    
        </Product>
    
        <Fragment>
            <Directory Id="TARGETDIR" Name="SourceDir">
              <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Test Folder" />
              </Directory>
            </Directory>
        </Fragment>
    
    </Wix>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-12
      • 2020-06-30
      • 1970-01-01
      相关资源
      最近更新 更多