WIX工具集MSI.如果代码中有多个CustomAction和多个Properties,如何使用WiX将CustomAc



我尝试使用这个:如何使用WiX将CustomActionData传递给CustomAction?

我有2个CA和几个属性。CustomActionData在第二个CA中使用。

产品.wxs:

<Binary Id="CustomAction1" SourceFile="..CustomAction1binDebugCustomAction1.dll"/>
<Binary Id="BinaryId1" SourceFile="..CustomAction2binDebugCustomAction2.dll"/>    
<CustomAction Id="CustomAction1" BinaryKey="CustomAction1" Execute="immediate" DllEntry="CustomAction1" />
<CustomAction Id="PrepCustomAction" Property="CustomAction2" Value="PROPERTY1=[NAME];PROPERTY2=[TRUST];PROPERTY3=[LOGIN];PROPERTY4=[PASSWORD];"/>
<CustomAction Id="CustomAction2" BinaryKey="BinaryId1" Execute="deferred" DllEntry="CustomAction2" Return="check" HideTarget="no"/>
<InstallUISequence>     
<Custom Action="CustomAction1" After="AppSearch">1</Custom>     
<Custom Action="PrepCustomAction" Before="CustomAction2" />
<Custom Action="CustomAction2" Before="InstallFinalize" />
</InstallUISequence>

CustomAction.cpp:

MsiGetProperty(hInstall, TEXT("PROPERTY1;PROPERTY2;PROPERTY3;PROPERTY4;"), buf, &buflen);

我希望buf包含属性,但它是空的。我做错了什么?

获取">CustomActionData";属性。在您的情况下,应该在CustomAction2中调用此方法。

MsiGetProperty(hInstall, TEXT("CustomActionData"), buf, &buflen);

之后,您需要将返回的字符串转换为dictionary,以获得每个属性的值。

最新更新