Search code examples
functionnsisuninstallation

Call must be used with function names starting with "un." in the uninstall section


...
!include "nsDialogs.nsh"
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "XML.nsh"
  !insertmacro "UpdateXml"
...
!insertmacro MUI_UNPAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
UninstPage custom un.PageReinstall
!insertmacro MUI_UNPAGE_CONFIRM
...

Function un.PageReinstall
...
${UpdateXml} "http://127.0.0.1/123.xml" "/XML/A" $321 ; line 232 
...
FunctionEnd

NSIS log:

!insertmacro: UpdateXmlCall Call must be used with function names starting with "un." in the uninstall section. Usage: Call function_name | [:label_name] Error in macro UpdateXmlCall on macroline 5 Error in script "G:\Basic.nsi" on line 232 -- aborting creation process

What's wrong?


Solution

  • The functions that are used by the uninstaller must be prefixed with un., and so do the macros.

    Thus, if you are using a macro and want to be able to use it from both installer and uninstaller, you must insert it 2 times (one with and another without the un. prefix).

    Adding or replacing the !insertmacro "UpdateXml" by !insertmacro un.UpdateXml at the begining of your script should fix the problem (provided that the un.UpdateXml macro is defined in the xml.nsh).