是否有其他方法可以访问延迟自定义操作中的会话详细信息?

发布于 2024-12-02 17:38:47 字数 414 浏览 1 评论 0原文

我有一个自定义操作,需要获取以下值以将某些部分从安装文件夹复制到 VS2010 文件夹

  1. VS2010 目录路径(VS2010DEVENV 属性)
  2. 安装路径(INSTALLLOCATION 属性)

给出足够的权限,我已将自定义操作设置为 Execute='deferred' Impersonate='no'。但运行安装程序时,它记录了以下消息:

无法通过非立即自定义操作访问会话详细信息

似乎我们无法访问“延迟”自定义操作中的属性(即 session["VS2010DEVENV"]

是否有其他方法可以让我根据需要检索这些值?

I have a custom action and need to get below values for copying some parts from installation folder to VS2010 folder

  1. VS2010 directory path (VS2010DEVENV property)
  2. Installation path (INSTALLLOCATION property)

To give enough privileges, I've set custom action as Execute='deferred' Impersonate='no'. But when running the installer, it logged the message:

Cannot access session details from a non-immediate custom action

It seems we cannot access a property in a "deferred" custom action (i.e session["VS2010DEVENV"])

Is there any other way so that I can retrieve those values as needed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

缱倦旧时光 2024-12-09 17:38:47

一定会有帮助。请特别注意页面底部,指导如何通过 自定义操作数据

以下是摘录:

将属性值写入安装脚本中以供使用
在延迟执行自定义操作期间:

  1. 在安装序列中插入一个小的自定义操作,将感兴趣的属性设置为同名的属性
    延迟执行自定义操作。例如,如果主键
    为延迟执行自定义操作“MyAction”设置一个属性
    将“MyAction”命名为您需要检索的属性 X。你
    必须在安装顺序之前设置“MyAction”属性
    “MyAction”自定义操作。尽管任何类型的自定义操作都可以
    设置上下文数据,最简单的方法是使用属性
    分配自定义操作(例如自定义操作类型 51)。
  2. 在处理安装序列时,安装程​​序会将属性 X 的值写入执行脚本中
    作为属性 CustomActionData 的值。

This must be helpful. Pay special attention to the bottom of the page, a guideline of 2 steps how to pass values via CustomActionData.

Here is the excerpt:

To write the value of a property into the installation script for use
during a deferred execution custom action:

  1. Insert a small custom action into the installation sequence that sets the property of interest to a property having the same name as
    the deferred execution custom action. For example, if the primary key
    for the deferred execution custom action is "MyAction" set a property
    named "MyAction" to the property X which you need to retrieve. You
    must set the "MyAction" property in the installation sequence before
    the "MyAction" custom action. Although any type of custom action can
    set the context data, the simplest method is to use a property
    assignment custom action (for example Custom Action Type 51).
  2. At the time when the installation sequence is processed, the installer will write the value of property X into the execution script
    as the value of the property CustomActionData.
深者入戏 2024-12-09 17:38:47

其他详细信息:可以通过在“自定义操作类型 51”中使用以下语法来传递多个属性值(这基本上只是设置属性值的自定义操作):

PROPERTY1=Value1;PROPERTY2=Value2;PROPERTY3=...

可以从自定义操作中检索值,如下所示

string prop1 = session.CustomActionData["PROPERTY1"];
string prop2 = session.CustomActionData["PROPERTY2"];

:为 ID 为“MyCustomAction”的自定义操作设置属性值的示例:

<CustomAction
  Id="SetCustomActionPropertyValues"
  Property="MyCustomAction"
  Value="INSTALLDIR=[INSTALLDIR];EXECUTABLE=[#MyExecutableFile]" />

(请阅读 这篇 MSDN 文章 了解有关格式化语法的更多详细信息,在本例中,该语法用于检索 ID 为“MyExecutableFile”的文件的安装位置)

Additional details: multiple property values can be passed by using the following syntax in a "Custom Action Type 51" (which is basically just a custom action that sets a property value):

PROPERTY1=Value1;PROPERTY2=Value2;PROPERTY3=...

Values can be retrieved from within the custom action like this:

string prop1 = session.CustomActionData["PROPERTY1"];
string prop2 = session.CustomActionData["PROPERTY2"];

Here's an example that sets property values for a custom action with ID "MyCustomAction":

<CustomAction
  Id="SetCustomActionPropertyValues"
  Property="MyCustomAction"
  Value="INSTALLDIR=[INSTALLDIR];EXECUTABLE=[#MyExecutableFile]" />

(read this MSDN article for more details on the formatted syntax which in this example is used to retrieve the install location of a file with ID "MyExecutableFile")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文