WIX:从 c# 类参数更改安装目录? [英] WIX: Change install directory from c# class parameter?

查看:28
本文介绍了WIX:从 c# 类参数更改安装目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个安装向导,我有一个页面,您可以在其中选择要安装程序的位置.在我的 c# 类中,我有 InstallPath 保存我想要安装程序的确切目录.

I'm creating an install wizard and i have a page where you can choose where you want to install the program. In my c# class i have InstallPath that keeps the exact directory i want to install the program.

默认为 c:\Program Files.

By default it's c:\Program Files.

在我的 WiX 设置文件中,我有:

In my WiX setup file i have that:

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
      <Directory Id ="Folder" Name="SomeFolder"/>
    </Directory>
</Directory>

我的问题是我不知道如何告诉这个 Wix 设置安装在 InstallPath 中.例如,如果 InstallPath 更改为 D:\SomeFolder\Here我想不再安装在 Program Files 中.

My problem is that i don't know how to tell this Wix setup to install in InstallPath. For example if InstallPath is changed to D:\SomeFolder\Here I want to install there not in Program Files again.

推荐答案

您可以使用以下自定义操作之一在安装期间更改属性值:

You can use one of these custom action to change the property value during install:

  1. 更改在 CostFinalize 之前计划的目录属性值的自定义操作
  2. 更改目录路径的类型 35 自定义操作(应在 CostFinalize 之后安排)

例如:

<CustomAction Id="ChangeDir" Directory="INSTALLFOLDER" Value="[SomeValueorPropertyhere]"/>

2.在 InstallExecution 阶段安排动作(必须在 CostFinalize 步骤之后):

2.Schedule the action during the InstallExecution phase (must be after the CostFinalize step):

<Custom Action="ChangeDir" After="CostFinalize"></Custom>

这篇关于WIX:从 c# 类参数更改安装目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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