wix - 安装过程中关于 InstallLevel 和条件的奇怪可重现行为
问题描述
我创建了一个复制 4 个文件的 MSI 安装程序。功能的安装级别为 1。如果存在必要的文件,则安装级别应为 0。我想避免文件被安装程序覆盖。所以我多次运行安装程序,这发生了
#1:安装程序复制 4 个文件。在日志文件中,安装级别为 1
#2:我删除了一个不必要的文件并再次运行安装程序。安装程序复制所有 4 个文件。在日志文件中,安装级别为 1
#3:我删除了一个不必要的文件并再次运行安装程序。没有文件被复制,但日志文件显示安装级别为 1
#4 - #n:与步骤 3 相同
#n+1:我删除了必要的文件,安装程序复制了文件。现在它像#1 和#2 一样开始。
在日志文件中,安装级别始终为 1,即使文件是否被复制。我无法解释它,在我理解问题之前我不想在生产中使用它。
您可能会看到我没有看到的问题(我已经替换了一些 GUID):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SplunkUFApp" Language="1033" Version="1.0.0.0" Manufacturer="XXXX" UpgradeCode="GUID">
<Package
InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Platform="x64"
Description="This app install Splunk Apps for SplunkUF"
Manufacturer="XXXX"
/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="SET_ADMIN_USER" Value="1" Admin="yes" />
<Property Id="APPDIR" Value="C:\Program Files\SplunkUniversalForwarder\etc\apps"/>
<Property Id="FILEEXISTSDEPLDEPLCONF">
<DirectorySearch Id="CheckFileDirDeplDeplConf" Path="[APPDIR]\deployment-client\default" Depth="0">
<FileSearch Id="CheckFileDeplDeplCon" Name="deploymentclient.conf" />
</DirectorySearch>
</Property>
<Property Id="FILEEXISTSDEPLAPPCONF">
<DirectorySearch Id="CheckFileDirDeplAppConf" Path="[APPDIR]\cdeployment-client\local" Depth="0">
<FileSearch Id="CheckFileDeplAppConf" Name="app.conf" />
</DirectorySearch>
</Property>
<Property Id="FILEEXISTSMGMTSRVCONF">
<DirectorySearch Id="CheckFileDirMgmtSrcConf" Path="[APPDIR]\disable-management-port\default" Depth="0">
<FileSearch Id="CheckFileMgmtSrcConf" Name="server.conf" />
</DirectorySearch>
</Property>
<Property Id="FILEEXISTSMGMTAPPCONF">
<DirectorySearch Id="CheckFileDirMgmtAppConf" Path="[APPDIR]\disable-management-port\local" Depth="0">
<FileSearch Id="CheckFileMgmtAppConf" Name="app.conf" />
</DirectorySearch>
</Property>
<!--
<InstallExecuteSequence>
<Custom Action="SetInstallLevel" Before="CostFinalize">Level = 1</Custom>
</InstallExecuteSequence>
-->
<!--<Icon Id="WixSplunkIcon" SourceFile=".\splunk\Icon\WixSplunkIcon" />-->
<Feature Id="ProductFeature" Title="SplunkUFApps" Level="1" Absent="allow">
<Condition Level="0">FILEEXISTSDEPLDEPLCONF</Condition>
<ComponentGroupRef Id="SplunkUFAppFiles" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="SplunkUniversalForwarder">
<Directory Id="dirC92E34D5819165AAA14D746AE415A35F" Name="etc">
<Directory Id="dirEAFEDB7E6F6E79D24B3FE857E39CF029" Name="apps">
<Directory Id="dirA06DAD83E8E8F22586D85DFF81184FD8" Name="deployment-client">
<Directory Id="dir875772AADBCFE4BF497174CEA0FD448B" Name="default">
<Component Id="cmpC0F0A5703B9741C49BFFE0475115B818" Guid="{9270BE5B-9CB4-4B64-9879-D7FF097AECFA}" Win64="yes" Permanent="no">
<File Id="fil7A09E8E5F656FE3A7F725973AE1C7DA4" KeyPath="yes" Source=".\etc\apps\deployment-client\default\deploymentclient.conf" />
</Component>
</Directory>
<Directory Id="dir75A306FD2D7B9DC877578079F7D71D1B" Name="local">
<Component Id="cmpD4FEF807094E7AB8D761F7C765955786" Guid="{C3D8BCD2-FC27-4657-A89C-78A2575D9EEB}" Win64="yes" Permanent="no">
<File Id="fil3D8A5BA116645C1B15D11233B7123F43" KeyPath="yes" Source=".\etc\apps\deployment-client\local\app.conf" />
</Component>
</Directory>
</Directory>
<Directory Id="dirD4334F764C543383F64BAF479F3D05D5" Name="disable-management-port">
<Directory Id="dir1BC3D0FF1ECF297186F2C326E7938F40" Name="default">
<Component Id="cmp950D6584943465D4011EAFAF31EA7C57" Guid="{16E9D266-6ACC-4E32-AB7E-24A9833FAEF8}" Win64="yes" Permanent="no">
<File Id="fil5B748F74651773A045797A98658C37E4" KeyPath="yes" Source=".\etc\apps\disable-management-port\default\server.conf" />
</Component>
</Directory>
<Directory Id="dir5A75D5F88C24AB95974D144B595459F6" Name="local">
<Component Id="cmpA3DA94E26C11179B468BF2800FDEA670" Guid="{918A8DF0-79D4-461C-8969-4136988F191E}" Win64="yes" Permanent="no">
<File Id="fil500DD05F4710DA2963187AFAF8827689" KeyPath="yes" Source=".\etc\apps\disable-management-port\local\app.conf" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="SplunkUFAppFiles" Directory="INSTALLFOLDER">
<ComponentRef Id='cmpC0F0A5703B9741C49BFFE0475115B818' />
<ComponentRef Id='cmpD4FEF807094E7AB8D761F7C765955786' />
<ComponentRef Id='cmp950D6584943465D4011EAFAF31EA7C57' />
<ComponentRef Id='cmpA3DA94E26C11179B468BF2800FDEA670' />
</ComponentGroup>
</Fragment>
</Wix>
解决方案
推荐阅读
- azure - 在 Azure 存储中生成对容器和 blob 的匿名公共读取访问权限?
- arduino - 上传时编译错误或在arduino ide中验证
- scala - 在火花流中为 MQTT 创建自定义接收器
- java - 为什么不使用自定义构造函数推断变量记录组件?
- java - file.listRoots 不适用于 Java 中的便携式 USB 驱动器
- java - 片段上的动作模式背景问题
- c# - 带有颜色的日历可用日期
- firebase - 如何为firebase中的不同用户指定不同的权限?
- regular-language - 如果 L 和 L 补码是递归可枚举的,那么为什么 L 不能是正则语言?
- python - 在大型图像数据集中计算均方误差的最快方法是什么?