在InstallScript项目中设置次要或重大升级



我正在使用installshield 2012 Spring -Premier Edition,我正在尝试用新设置脚本中的任何内容替换我们的软件的现有安装(如果存在的话)再次运行。

我在网上阅读了一些内容,这些内容是为了配置次要和主要升级设置。

我有一个installscript项目,我找不到如何进行次要和重大升级,就像使用基本的MSI项目可以完成。我在线阅读,这可以通过进入安装设计师,然后再进行媒体/升级,然后配置升级,从而可以通过MSI项目完成。此选项在InstallScript项目中不可用。

我可以在installscript项目中使用什么来改变此行为?预先感谢您。

我相信您需要在主脚本中添加更多事件处理程序。首先,如果尚未存在以下处理程序,则需要添加以下处理程序:

  • onshowui
  • onupdateuibefore
  • onupdateuiafter
  • onmaintuibefore
  • onmaintuiafter

重要的是要拥有onshowui,以便运行适当的"之前"方法。以下是我做的;您需要在其他方法中执行您需要做的任何事情(我的特定于域,我无法直接提供这些方法)。

//---------------------------------------------------------------------------
// OnShowUI
//
// This function drives the UI sequence and file transfer of the setup.
// 
// The OnShowUI event is called directly by the framework to initiate
// the UI sequence and file transfer of the setup. By default this event
// displays UI that informs the end user that the maintenance setup has been
// completed successfully.
//---------------------------------------------------------------------------
function OnShowUI()
    BOOL bMaintenanceMode, bUpdateMode;
    string szIgnore, szTitle;
    LIST listDirs;
    number nFindAllDirsResult, nFindAllFilesResult;
    BOOL lDirEmpty;
begin
    // Enable dialog caching
    Enable( DIALOGCACHE );
    // Determine what events to show
    bUpdateMode = FALSE;
    bMaintenanceMode = FALSE;
    // Remove this to disabled update mode
    if (UPDATEMODE) then
        // checking to make sure app still exists in orig location
        if Is(PATH_EXISTS, TARGETDIR) then
            // Also check for empty TargetDir
            lDirEmpty = IsTargetDirEmpty();
            if (lDirEmpty) then
                // TARGETDIR is completely empty, so disable UPDATE mode
                bUpdateMode = FALSE;
            else
                // TARGETDIR has some contents, so continue with UPDATE
                bUpdateMode = TRUE;
            endif;
        else
            // Turn off Update mode if original folder is gone
            bUpdateMode = FALSE;
        endif;
        if (!bUpdateMode) then
            // If Update mode is set but the original target is missing
            // need to flag the installer to force full reinstall (otherwise it will 
            // think all features have already been installed (by analyzing the log))
            FeatureReinstall();
        endif;
    endif;
    // Remove this to disable maintenance mode.
    if (MAINTENANCE) then
        // checking to make sure app still exists in orig location
        if Is(PATH_EXISTS, TARGETDIR) then
            // Also check for empty TargetDir
            lDirEmpty = IsTargetDirEmpty();
            if (lDirEmpty) then
                // TARGETDIR is completely empty, so disable Maint mode
                bMaintenanceMode = FALSE;
            else
                // TARGETDIR has some contents, so continue with Maint
                bMaintenanceMode = TRUE;
            endif;
        else
            // Turn off maintenance mode if original folder is gone
            bMaintenanceMode = FALSE;
        endif;
        if (!bMaintenanceMode) then
            // If Maintenance mode is set but the original target is missing
            // need to flag the installer to force full reinstall (otherwise it will
            // think all features have already been installed (by analyzing the log))
            FeatureReinstall();
        endif;
    endif;
    // Show appropriate UI
    if( bUpdateMode ) then
        OnUpdateUIBefore();
    else
        if ( bMaintenanceMode ) then
            OnMaintUIBefore();
        else
            OnFirstUIBefore();
        endif;
    endif;
    // Move Data
    OnMoveData();
    if( bUpdateMode ) then
        OnUpdateUIAfter();
    else
        if ( bMaintenanceMode ) then
            OnMaintUIAfter();
        else
            OnFirstUIAfter();
        endif;
    endif;
    // Disable dialog caching
    Disable(DIALOGCACHE);
end;

我会说,在onupdateuibefore中,我评论了以下代码:

// Check whether the update is needed.
if( nResult = VERSION_COMPARE_RESULT_SAME ) then
    // Note: This result should occur only for differential media, since the setup
    // will display OnMaintUIBefore or OnFirstUIBefore by default if the versions match
    // for full setup media.
    szMsg = SdLoadString( IDS_IFX_WARNING_UPDATE_NOT_NEEDED );
    SdSubstituteProductInfo( szMsg );
    if( MessageBox( szMsg, MB_ICONEXCLAMATION | MB_YESNO ) != IDYES ) then
        abort;
    endif;
endif;

我不记得为什么,但我怀疑这会导致更新模式无法正常工作。

i自动化我的installshield构建(通过com--如果有兴趣(如果有兴趣),请查看此答案),并且该过程的一部分涉及在新的安装程序对旧版本运行时触发次要版本以触发更新模式。/p>

祝你好运!

相关内容

  • 没有找到相关文章

最新更新