【发布时间】: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