在Basic MSI中从Installscript更新INSTALLDIR

The*_*ing 1 installshield installscript

我想使用Installscript在安装期间更改我的安装程序的INSTALLDIR值.我该怎么办?我已经尝试过以下操作:创建自定义操作:

function InitializeValues(hMSI)
    STRING svProductName; 
    STRING svInstallDir;  
    NUMBER nvSize;
begin                        
    nvSize=255; 
    MsiGetProperty (hMSI, "ProductName", svProductName, nvSize);  
    if(svProductName = "Notepad Pro") then  
         svInstallDir = PROGRAMFILES ^ svProductName;
 //     MsiSetTargetPath(hMSI,INSTALLDIR,svInstallDir);      
        MsiSetProperty(hMSI,INSTALLDIR,svInstallDir);
        MessageBox(INSTALLDIR,INFORMATION);
    endif;
end;
Run Code Online (Sandbox Code Playgroud)

我的自定义操作已执行但INSTALLDIR的值不会更改.我已经在成本最终确定之前在UI序列中安排了我的自定义操作,并且在成本最终确定之后执行顺序中.

请帮忙.

Cos*_*rvu 5

在InstallUISequence和InstallExecuteSequence中,自定义操作应在CostFinalize之前运行.此外,MsiSetProperty没有这种方式使用,我不认为它将在InstallScript中工作.

您可以尝试使用:

INSTALLDIR = svInstallDir
Run Code Online (Sandbox Code Playgroud)

要么

MsiSetProperty(hMSI, "INSTALLDIR", svInstallDir);
Run Code Online (Sandbox Code Playgroud)