簡體   English   中英

WIX 工具集 MSI。 如果代碼中有多個 CustomAction 和多個 Properties,如何使用 WiX 將 CustomActionData 傳遞給 CustomAction?

[英]WIX Toolset MSI. How to pass CustomActionData to a CustomAction using WiX if there are several CustomAction and several Properties in the code?

我嘗試使用這個: How to pass CustomActionData to a CustomAction using WiX?

我有 2 個 CA 和幾個屬性。 CustomActionData 在第二個 CA 中使用。

產品.wxs:

<Binary Id="CustomAction1" SourceFile="..\CustomAction1\bin\Debug\CustomAction1.dll"/>
<Binary Id="BinaryId1" SourceFile="..\CustomAction2\bin\Debug\CustomAction2.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 包含屬性,但它是空的。 我究竟做錯了什么?

使用 MsiGetProperty 方法獲取“ CustomActionData ”屬性的值。 在您的情況下,應該在CustomAction2中調用此方法。

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

在此之后,您需要將返回的字符串轉換為字典以獲取每個屬性的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM