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

1 つの .nsi ファイルで作業し、実際に別の .nsi ファイルをコンパイラに渡すのと同じくらい簡単でしょうか?

またはそのような単純なものをスクリプトの先頭に追加!error "Hello World"して、調べることができます...

編集:

書き込み用の出力ファイルを開くことができない場合、エラー メッセージは「出力ファイルを開けません」であり、OutFile とは関係ありません。

Stdin を使用してスクリプトを渡す場合を除き、OutFile をまったく使用しない場合でも、ベース名として .nsi ファイル名を選択する必要があります。

makensis.exe に渡す正確なパラメーターと実際のスクリプトのコピーを使用してください。

于 2013-03-18T05:20:51.443 に答える