1

新しいバージョンをインストールする前に、以前のバージョンのアンインストールを必須にするインストーラーがあります。

ただし、最初の質問が尋ねられると、そうします。しかし、アンインストールのダイアログはそうではありません。

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
  "${PRODUCT_NAME} is already installed. $\n$\nIf you have software older than 3.0,     please manually uninstall it with Windows before procedeing. $\n$\nClick `OK` to remove the \
  previous version or `Cancel` to cancel this upgrade." \
  IDOK uninst IDCANCEL giveup

; I am giving up
giveup:
Abort

;  Run the uninstaller
uninst:
 ClearErrors
 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
 IfErrors no_remove_uninstaller
 no_remove_uninstaller:
 install:
 ; ..... snip

それからここに

Function un.onInit
   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to     completely remove $(^Name) and all of its components?" IDYES NoAbort
  Abort
  NoAbort:
FunctionEnd

そのため、スタンドアロンのアンインストールの場合は問題ないように見えますが、最初のアンインストールの場合、ユーザーがいいえ/キャンセルと言った場合、ユーザーがいいえと言ったときにインストーラーが続行されます。どうしてなのか、理由が思いつきません。悪い副作用として、スタート メニューのプログラム ファイル アイコンが孤立し、uninst.exe が孤立します。しかし、アンインストーラーを「手動で」実行すると問題ないようです。このことを機能させようとする以外に、そのロジックを変更していませんでした。

ありがとう。

4

1 に答える 1

2

ExecWait でパスを引用し、終了コードを確認することが重要です。

Function .onInit
StrCpy $R0 "c:\old install" ; TODO: Somehow find the old install (in the registry? InstallDirRegKey?) and put its path in $R0
IfFileExists "$R0\*.*" 0 noOldInstall
    MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is already installed. blahblah..." IDOK uninstOld
    Abort
    uninstOld:
    ExecWait '"$R0\uninstaller.exe" _?=$R0' $R1
    ; Exit codes are documented in Appendix D in the help file.
    StrCmp $R1 0 noOldInstall ; Success? If so we are done...
    Abort ; Uninstaller was canceled or failed, we cannot continue
noOldInstall:
FunctionEnd
于 2013-04-11T18:51:04.927 に答える