开发者

Updating the INSTALLDIR from Installscript in Basic MSI

开发者 https://www.devze.com 2023-03-07 01:41 出处:网络
I want to change the INSTALLDIR value for my Installer during Installation using Installscript. How should I do it?

I want to change the INSTALLDIR value for my Installer during Installation using Installscript. How should I do it? I have already tried the following: Created a custom action as:

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;

My custom action gets executed but the value of INSTALLDIR does not changes. I have scheduled my custom action in UI Sequence before Cost Finalize and in Execute Sequence After Cost Finalize.

Please help.


In both InstallUISequence and InstallExecuteSequence the custom action should run before CostFinalize. Also, MsiSetProperty is not used that way and I don't think it will work in InstallScript.

You can try using:

INSTALLDIR = svInstallDir

or

MsiSetProperty(hMSI, "INSTALLDIR", svInstallDir);
0

精彩评论

暂无评论...
验证码 换一张
取 消