我在阅读链接后编写了这段代码:http: //blogs.technet.com/b/alexshev/archive/2008/03/25/property-does-not-exist-or-empty-when-accessed-from-延迟自定义action.aspx
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="MergeModule1" Language="1033" Version="1.0.0.0">
<Package Id="cffa568e-1bf0-4eb3-bee3-eb5801a0bbd0" Manufacturer="Microsoft" InstallerVersion="200" />
<Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[PRIMARYFOLDER];SourceDir=[SourceDir]" />
<CustomAction
Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="CustomAction1"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" Before="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
<!--<InstallUISequence>
<Custom Action="CA_myCustomAction" After="CostFinalize"></Custom>
</InstallUISequence>-->
</Module>
</Wix>
代替InstallDir - PRIMARYFOLDER
,我尝试了 - INSTALLLOCATION、InstallDir、TargetDir,但我无法获取为 ProgramFiles(x86) 下的应用程序指定的安装文件夹。
的值SourceDir
作为 MSI 文件运行时所在位置的正确值出现。