zoukankan      html  css  js  c++  java
  • InstallShield 工程类型installscript,如何覆盖安装?

     1、  开始使用的msi工程类型。网上找了资料, 在kevin的博客里找到这条方法 可以通过删除Execute Sequence中的RegisterProduct和PublishProduct两个CA实现同样的需求

    试过之后确实是可以 重复安装的,但是 执行开始菜单中的卸载是无法卸载的执行有下图的 错误:

    问过人也找过资料 说将它的属性Arguments、Target 分别设为:/x [ProductCode]、 [SystemFolder]msiexec.exe

    即可卸载,但不知道为什么我们的产品 GUID没变过,执行卸载的时候,提示 不是一个产品。如下图

     而控制面板是不能显示该程序的。所以此方法不可行。

    2、  换了个工程类型,使用 installscript工程类型,此类型的 脚本中 advanced下面有个 OnShowUI(msi没有这个方法,即存放的检测是已安装、更新、还是第一次安装 的脚本,修改逻辑

    如果是第一次安装执行OnFirstUIbefore() ;(不必修改)

    如果是更新执行 OnUpdateUIBefore();(不必修改)

    如果是已经安装 默认是执行的OnMaintUIBefore(); 则修改为 继续执行 OnFirstUIbefore();

    此时调试 覆盖安装会覆盖不了文件。调用一个修复方法FeatureReinstall(); 就可以 覆盖文件了 

    在 卸载的快捷方式中添加一个参数 -removeonly,检测判断此参数为卸载功能,即 开始菜单的卸载可以正常卸载。

    注意:这里如果不加这个参数执行卸载也是覆盖安装

    OnShowUI() 修改代码如下: 

    function OnShowUI()
    BOOL    bMaintenanceMode, bUpdateMode;
    string    szIgnore, szTitle;
    begin        
            // Enable dialog caching
            Enable( DIALOGCACHE );
            
            // Determine what events to show.
            bUpdateMode    = FALSE;
            bMaintenanceMode = FALSE;
        
            // Remove this to disabled update mode.
            if( UPDATEMODE ) then
                bUpdateMode = TRUE;
            endif;
    
            // Remove this to disable maintenance mode.
            if ( MAINTENANCE ) then
                bMaintenanceMode = TRUE;          
            endif;
    
            // Show appropriate UI       
            if( REMOVEONLY )   then   
                //    MessageBox ("卸载", SEVERE);
                    OnMaintUIBefore(); 
            else               
                if( bUpdateMode ) then   
                 //    MessageBox ("更新", SEVERE);
                    OnUpdateUIBefore();
                 else  
                     if ( bMaintenanceMode ) then  
                         
                        if( MessageBox( "您已安装最新版本,是否覆盖安装?" , MB_YESNO ) != IDYES ) then
                            abort;
                        endif;                        
                        OnFirstUIBefore();     
                        FeatureReinstall(); 
                    else
                    //    MessageBox ("第一次安装", SEVERE);                   
                        OnFirstUIBefore(); 
                    endif;
                 endif; 
            endif;
    
            // Move Data
            OnMoveData(); 
            
            //OnFirstUIAfter();  
            if( REMOVEONLY )   then
                    OnMaintUIAfter();
            else            
                    OnFirstUIAfter();            
            endif;
    
            // Disable dialog caching
            Disable(DIALOGCACHE);
    
    end;
  • 相关阅读:
    Linux混杂设备驱动学习
    Linux字符设备驱动解析
    U-BOOT-Linux启动指令bootm分析
    项目-基于视频压缩的实时监控系统--tiny6410
    django分页linaro-django-pagination
    django FileFIeld和ImageField 上传路径改写
    ajaxFileUpload用法
    gzip压缩
    编写EL函数
    struts2上传下载
  • 原文地址:https://www.cnblogs.com/daocaorenbx/p/3305162.html
Copyright © 2011-2022 走看看