1

我正在尝试学习 NSIS 来为项目创建安装程序和卸载程序,并且我正在尝试按照教程部分中的示例进行操作。我尝试了以下脚本:-

# define the name of the installer
outfile "installer.exe"

# define the directory to install to, the desktop in this case as specified  
# by the predefined $DESKTOP variable
installDir $DESKTOP\Harshit\NSIS\Scripts

# default section
section

# define the output path for this file
setOutPath $DESKTOP\Harshit\NSIS\Files

# define what to install and place it in the output path
File test1.txt

# define uninstaller name
writeUninstaller $DESKTOP\Harshit\NSIS\Scripts\uninstaller.exe

sectionEnd

# create a section to define what the uninstaller does.
# the section will always be named "Uninstall"
section "Uninstall"

# Always delete uninstaller first
delete $DESKTOP\Harshit\NSIS\Scripts\uninstaller.exe

# now delete installed file
delete $DESKTOP\Harshit\NSIS\Scripts\Files\test1.txt

sectionEnd

但是,我收到一条错误消息:

无效的脚本:从来没有 OutFile 命令。

我可以在顶部看到 outfile 命令,但我不知道为什么它不起作用。请问有什么建议吗?

4

1 回答 1

4

是否可以像处理一个 .nsi 文件并实际将不同的 .nsi 文件传递​​给编译器一样简单?

您可以在脚本顶部添加!error "Hello World"或类似的简单内容以找出...

编辑:

如果它无法打开输出文件以写入错误消息应该是“无法打开输出文件”并且与 OutFile 无关。

除非您使用 stdin 传递脚本,否则即使您根本不使用 OutFile,它也应该选择 .nsi 文件名作为基本名称。

您能否展示使用您传递给 makesis.exe 的确切参数和您的真实脚本的副本?

于 2013-03-18T05:20:51.443 回答