2013-03-18 48 views
0

我想学习NSIS为项目创建一个安装程序和一个卸载程序,我试图按照教程部分中的示例。我想下面的脚本: -NSIS错误:无效的脚本:从来没有OutFile命令

# 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 

但是,我得到一个错误,指出:

invalid script: never had OutFile command.

我可以在上面看到OUTFILE命令,但我想不出为什么它是不工作。有什么建议吗?

回答

4

难道它就像你在一个.nsi文件上工作一样简单,并且实际上将一个不同的.nsi文件传递给编译器?

您可以添加!error "Hello World"或一些简单的像,为您的脚本来找出顶部...

编辑:

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

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

您能否使用您传递给makensis.exe的确切参数以及您真实脚本的副本?

+0

不,我再次检查。我将正确的文件传递给编译器。但是,在添加显示的行后!error filename然后显示相同的错误。我还更改了文件夹的权限以允许所有用户写入文件夹。 – user1439090 2013-03-18 09:09:03

相关问题