0

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.

By default it's c:\Program Files.

In my WiX setup file i have that:

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

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.

4

2 回答 2

1

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

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

例如:

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

2.在 InstallExecution 阶段调度操作(必须在 CostFinalize 步骤之后):

<Custom Action="ChangeDir" After="CostFinalize"></Custom>
于 2013-09-10T20:45:19.253 回答
0

改变路径是:

<Product Id="*"> 
    <Property Id="ROOTDRIVE">
        <![CDATA[D:\]]>
    </Property>
</Product>

对于新路径 D:\SomeFolder\Here,将是这样的。

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="SomeFolder" Name="SomeFolder">
        <Directory Id="INSTALLFOLDER" Name="Here"/>
    </Directory>
</Directory>

问候,

于 2014-04-02T16:08:28.373 回答