Wix-访问在其他CA中动态创建的延迟自定义操作的属性值 [英] Wix - Accessing the property values from deferred custom action created dynamically in other CA

查看:82
本文介绍了Wix-访问在其他CA中动态创建的延迟自定义操作的属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装一个必须配置其安装的Web服务的安装程序。它动态生成属性,这些属性保存UI序列中从用户收集的数据,安装服务并设置参数。

I'm making an installer which must configure a web service it installs. It dynamically generates properties which hold the data collected from the user in the UI sequence, installs the service and sets the parameters.

SetParams CA使用UI序列中生成的动态属性。为了访问延迟CA中的数据,我创建了一个即时CA,该CA动态提取会话数据并将其放入CustomActionData中。

SetParams CA uses dynamic properties generated in the UI sequence. To access data in deferred CA, I've created an immediate CA which dynamically extracts session data and puts it in the CustomActionData.

<CustomAction Id='SaveParams' BinaryKey='Setup.CustomAction' DllEntry='SaveParameters' Execute='immediate'  Return='check'/>
<CustomAction Id='SetParams' BinaryKey='Setup.CustomAction' DllEntry='SetParameters' Execute='deferred' Impersonate='no' Return='check' />

<Custom Action='SaveParams' Before='SetParams'><![CDATA[REMOVE <> "ALL"]]></Custom>
  <Custom Action='SetParams' Before='InstallFinalize'><![CDATA[REMOVE <> "ALL"]]></Custom>

以下是自定义操作中SaveParameters方法的一部分

Following is the part of SaveParameters method in the custom action

customActionData.Append(string.Format(CultureInfo.InvariantCulture, "{0}={1};", propertyName, session[propertyName]));

此方法有效!
从admin cmd会话启动时,[propertyName]返回正确的值,但是当我从非高架cmd提示符运行安装程序更改时,我无法访问直接CA中的属性值-session [propertyName]返回空字符串?!

This approach works! When started from admin cmd session[propertyName] returns the correct value, but when I run the installer change from non-elevated cmd prompt, I cannot access the property values in the immediate CA - session[propertyName] returns empty string ?!

我可以访问wxs文件中定义的(静态)属性

I can access the (static) property defined in wxs file

<Property Id="INSTALL" Secure="yes" /> 

但不是我在UI序列中的其他一些直接自定义操作中添加的对象,例如

but not the one's I've added in some other immediate custom action in the UI sequence like this

session[property] = "VALUE"; //eq. property = DATABASENAME

有人知道我为什么无法读取动态公共属性值吗?

Does anyone have any idea why I cannot read the dynamic public property value?

注意:从此问题

推荐答案

有两个解决方案。
1.读取要从执行序列移至UI序列的属性的立即操作
2.执行阶段的操作可以按照问题所述从安全属性访问数据。
如果属性是在CA中动态创建的,则必须将其添加到SecureCustomProperties系统属性。分隔符char是;。

There are two options for resolving this issue. 1. Immediate action which reads properties to be moved from execution sequence to UI sequence 2. Actions in execution phase can access data from secure properties as stated in the question. If the properties are dynamically created in CA, they must be added to SecureCustomProperties system property. Separator char is ';'.

这篇关于Wix-访问在其他CA中动态创建的延迟自定义操作的属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆