在安装包运行时指定Component的安装路径

Basic MSI工程类型中如果实现动态指定安装路径的功能,下面介绍的方法也适用于InstallScript MSI工程。

1. 在Setup Design中找到相对应的Component。

2. 点击Destination的后侧的“...”按键。

3. 在Browse for Directory对话框中,选中Destination Computer后点击鼠标右键选择“New Directory” ,默认会参数一个NEW_DIRECTORY1,点击OK。

4. 在Property Manager中添加一个 NEW_DIRECTORY1属性。

5. 在脚本中添加如下代码:

export prototype SetRuntimeProperty(function SetRuntimeProperty(hMSI) 
    STRING szRuntimeDestination ;
    NUMBER nCnt;
begin;  
    szRuntimeDestination C:\Kevin WanMsiSetProperty(hMSI,NEW_DIRECTORY1,szRuntimeDestination);

6. 添加一个CA,与脚本函数SetRuntimeProperty绑定。

7. 将CA插入到User Interface序列中,放到SetupInitialization之后,设置运行条件为:Not Installed。

8. 编译,运行安装包。 

原文地址:https://www.cnblogs.com/wcadaydayup/p/5405366.html