Archive: NSIS for VS.Net 05 and 03


NSIS for VS.Net 05 and 03
I am currently using .nsi files to build an executable, which contains an .exe and some dlls. (header)

; NULLsoft Scriptable Install System
; make a single file to run
; software. Goal is to copy files to
; the temp directory, run them, then
; clean up completely afterward.

When i us the script for vs03, the .exe created executes perfectly. However, with vs05, the .exe created SUCKS!! The files are unpacked, but immediatley removed from the $Temp.

How do i use this with vs05.

Script in .nsi----

; NULLsoft Scriptable Install System
; make a single file to run
; software. Goal is to copy files to
; the temp directory, run them, then
; clean up completely afterward.

; use LZMA Solid compression
SetCompressor /solid lzma

; name of the installer (doesn't matter/never seen)
Name "AQS"

; hide nsis windows
SilentInstall silent

; set icon file
Icon "P:\AQS Projects\@QS Packages\AQS_auto.ico"

; set a name for the resulting executable
OutFile "WinFrameTest.exe"

; the installation directory
InstallDir "$TEMP\WinFrameTest"

; copy, run, delete
Section ""

; set output path to the installation directory.
SetOutPath "$INSTDIR"

; files to unpack
File "winTestbasic.exe" ; executable
File "IsummonYou.dll" ; required dll
File "IsummonMe.dll" ; required dll

; execute and wait for program to be closed
ExecWait '"$INSTDIR\WinFrameTest.exe"'

; change output path so we can delete folder and not just contents
SetOutPath "$TEMP"

; Delete unpacked files from hard drive
RMDir /r "$INSTDIR"
SectionEnd


What do you mean by "Use the script for vs03". Do you mean the exe's and dll's were recompiled with VS05? If so, there may be additional dependencies such as DLLs or .NET 2.0 that are not on the machine your are installing on.

To troubleshoot and find the cause I would first comment out the RMDir command so that the installer will leave the files, and then after you install the files will be left where they are and you can then manually execute the *.exe from it's location in the temp dir to see why it might be failing. (I would add a DetailPrint statement in the section that prints out the OUTDIR so you know which temp file location to look in.

I suspect that this is happening:
1) ExecWait runs your exe
2) your EXE is throwing an exception or failing in some way
3) NSI script execution then continues to the RMDir command and deletes the files.

This would cause it to appear that your EXE is not running and the files being deleted immediately.

You could also clear errors before ExecWait and then check for errors afterwards.

Good luck.