Archive: NSIS 'ifnewer'


NSIS 'ifnewer'
The product I work on at one point used installshield and now uses NSIS.

I have an issue though, when trying to install a new version of the product over an old version, if the old version is old enough to have been installed with installshield, then certain files fail to get overwritten, which causes major problems in the product.

I lay no blame on NSIS but I am wondering how the NSIS ifnewer option is handled? How does it check if it's newer?

If it goes by the last modified date and time, then someone else must be wrong because even when the last modified date is a full year old this problem has been reported.

Thanks.


Perhaps InstallShield is 'repairing' the old files and replacing your new ones with cached versions of the originals. That is a feature of InstallShield, perhaps the biggest reason I switched from InstallShield to NSIS.

You might want to wipe out the InstallShield cache (I found it in $Windir\Installer\xxxx.msi)

Here's the code I have in one of my installers. You'll have to look up the GUID for your own installer and modify this code to delete the keys/files for your own installer.

ClearErrors
ReadRegStr $R0 HKLM "${Uninstall_KEY}\InstallShield_{BE1DC3D5-CF2A-4165-B7FF-8228BE17F47B}" "DisplayVersion"
${Unless} ${Errors}
DetailPrint "Cleaning ARP entry"
# delete the old InstallShield ARP entry
DeleteRegKey HKLM "${Installer_CLASSES_KEY}\5D3CD1EBA2FC56147BFF2882EB714FB7"
DeleteRegKey HKLM "${Installer_CLASSES_Features}\5D3CD1EBA2FC56147BFF2882EB714FB7"
DeleteRegKey HKLM "${Uninstall_KEY}\InstallShield_{BE1DC3D5-CF2A-4165-B7FF-8228BE17F47B}"
DeleteRegKey HKLM "${Uninstall_KEY}\InstallShield Uninstall Information\{BE1DC3D5-CF2A-4165-B7FF-8228BE17F47B}"
DeleteRegKey HKLM "${Uninstall_KEY}\{BE1DC3D5-CF2A-4165-B7FF-8228BE17F47B}"
ReadRegStr $R0 HKLM "${Installer_KEY_PRD}\5D3CD1EBA2FC56147BFF2882EB714FB7\InstallProperties" "LocalPackage"
Delete $R0 ; C:\Winnt\Installer\xxxxx.msi
StrCpy $R0 "$WINDIR\Installer\{BE1DC3D5-CF2A-4165-B7FF-8228BE17F47B}"
RmDir /r $R0
DeleteRegKey HKLM "${Installer_KEY_PRD}\5D3CD1EBA2FC56147BFF2882EB714FB7"
DeleteRegKey HKLM "${Installer_KEY_UPG}\E48C006C5E337CB49B506DC4ACAD1D84"
DeleteRegValue HKLM "${Installer_KEY_Fld}" "$R0\"
${EndUnless}

Notice that the two different GUIDS are related to each other: the one beginning "BE1DC3D5-CF2A-" and the one "5D3CD1EBA2FC" are the same basic values with the sections between dashes written in reverse when they leave out the dashes.