我使用Wix,并有一个customAction和一个anb installSequence:
<CustomAction Id='PreInstallAction' BinaryKey='PreInstallBinary' DllEntry='MyCustomAction1' Execute='immediate'
Return='check'/>
<Binary Id='PreInstallBinary' SourceFile='E:\...\MyCustomAction\bin\Release\MyCustomAction.CA.dll'/>
<InstallExecuteSequence>
<Custom Action='PreInstallAction' Before='InstallInitialize'/>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)
问题是我的自定义操作被调用了两次 - (在自定义操作中,我将东西打印到日志文件中,我看到它们两次)
我试着评论这条线:
<MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes" DowngradeErrorMessage="Can't downgrade from newer version" />
Run Code Online (Sandbox Code Playgroud)
它解决了这个问题.但我需要主要更新,所以我尝试取消注释上面的行并为customAction添加一个条件:
<InstallExecuteSequence>
<Custom Action='PreInstallAction' Before='InstallInitialize'>
NOT Installed AND NOT PATCH
</Custom>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)
但现在ny customAction再次被调用两次......我的情况有什么问题吗?我有其他解决方案吗?