我遇到了WiX和C ++自定义操作DLL的问题:我想从自定义操作dll获取.wxs文件中指定的安装位置,我使用的是WcaGetTargetPath,但此API不起作用。任何人都知道如何做到这一点?
WiX文件:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
<Directory Id="CompanyDir" Name="ABC">
<Directory Id="PCMINSTALLDIR" Name="ClientMonitor">
<Directory Id="STDSCIPTSDIR" Name="standard_scripts">
</Directory>
<Directory Id="CSTMSCIPTSDIR" Name="custom_scripts">
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
.....
<CustomAction Id="ChangeConfig"
BinaryKey="PcmConfig"
DllEntry="ModifyConfigFile"
Execute="deferred"
Return="check"
Impersonate="no"
HideTarget="no" />
<InstallExecuteSequence>
<Custom Action="ChangeConfig" Before="InstallFinalize" />
</InstallExecuteSequence>
Custom Action method:
LPWSTR pwzTargetPath = NULL;
hr = WcaGetTargetPath(L"PCMINSTALLDIR", &pwzTargetPath);
ExitOnFailure(hr, "Failed to get the PCM installation path.");