【问题标题】:Call must be used with function names starting with "un." in the uninstall section调用必须与以“un”开头的函数名称一起使用。在卸载部分
【发布时间】:2012-10-01 22:28:01
【问题描述】:
...
!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 日志:

!insertmacro: UpdateXmlCall 调用必须与函数名称一起使用 以“联合国”开头。在卸载部分。用法:调用 函数名 | [:label_name] 宏 UpdateXmlCall 中的错误 宏行 5 第 232 行的脚本“G:\Basic.nsi”中的错误——正在中止 创作过程

怎么了?

【问题讨论】:

    标签: function nsis uninstallation


    【解决方案1】:

    卸载程序使用的函数必须以un.为前缀,宏也是如此。

    因此,如果您正在使用宏并且希望能够从安装程序和卸载程序中使用它,则必须将其插入 2 次(一次带有 un. 前缀,另一次不带有 un. 前缀)。

    在脚本开头添加!insertmacro "UpdateXml" 或将!insertmacro un.UpdateXml 替换为!insertmacro un.UpdateXml 应该可以解决问题(前提是un.UpdateXml 宏在xml.nsh 中定义)。

    【讨论】:

    • 但是由于UpdateXml/un.UpdateXml 不能调用另一个宏,它仍然无法编写好的代码。我很沮丧!
    【解决方案2】:

    How to call an nsi function in uninstall section? 的回答展示了如何使用宏避免函数重复:

    !macro TestFunction UN
    Function ${UN}TestFunction
       ;do stuff
    FunctionEnd
    !macroend
    !insertmacro TestFunction "" 
    !insertmacro TestFunction "un."
    

    用途:

    Section "Install"
      Call TestFunction
    EndSection
    
    Section "Uninstall"
      Call un.TestFuction
    SecionEnd
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      • 2020-12-31
      • 2015-08-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多