本文介绍了从C ++获取CustomActionData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Wix 文件,其中创建一个延迟自定义操作。我写了一个 C#程序,现在,循环的 CustomActionData 并打印。考虑下面给出的代码段:

I have a Wix file where I am creating a Deferred Custom Action. I have written a C# program, which is, for now, looping over the CustomActionData and printing the Key and Values. Consider the snippet given below:

<Binary Id="myAction" SourceFile="..\Type51CA\bin\Release\Type51CA.CA.dll" />
<CustomAction Id="CustomAction1" Property="CustomAction2" Value="SomePropertyOne=[INSTALLFOLDER];SomePropertyTwo=[IPADDRESS];" />
  <CustomAction Id="CustomAction2" BinaryKey="myAction" DllEntry="MyCustomAction" Execute="deferred" Return="check" HideTarget="no" />
<InstallExecuteSequence>
   <Custom Action="CustomAction1" Before="CustomAction2" />
   <Custom Action="CustomAction2" Before="InstallFinalize" />
</InstallExecuteSequence>

我设置 SomePropertyOne c $ c> SomePropertyTwo 在CA Id =CustomAction1

I am setting the SomePropertyOne and SomePropertyTwo in CA Id="CustomAction1".

C#代码可以迭代 CustomActionData

session.Log("Begin MyCustomAction");
CustomActionData datas = session.CustomActionData;
foreach (KeyValuePair<String, String> data in datas)
{
   session.Log(String.Format("Key = {0} Value = {1}\n", data.Key, data.Value));
}



由于我要删除.Net的依赖,我想写等同于C ++中的C#代码;使用 WcaGetProperty(LCustomActionData,& caData)没有给我任何结果。在C ++中,如何从 CustomActionData

Since I want to remove the dependency of .Net, I want to write the equivalent C# code in C++; using WcaGetProperty(L"CustomActionData",&caData) didn't give me any result. In C++, how can I get the required value of a corresponding Key from CustomActionData?

推荐答案

CustomActionData可以随意简单,我最喜欢的是,但在现实中它并不重要,只要CA设置属性和CA解码属性遵循相同的规范。

CustomActionData can be as simple as you want or as complicated as you want. My favorite is JSON but in reality it doesn't really matter as long as the CA setting the property and the CA decoding the property follow the same spec.

这篇关于从C ++获取CustomActionData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:54