I have created a PowerTest.NSI file. In this file i have included the required dlls and exes like as shown below and also added the required commnads.
File E:\Source\PowerTest.exe
File E:\Source\testutil.dll
File E:\Source\ntutil.dll
Finally I have loaded this NSI script file, it has generated PowerTest.exe
I run this PowerTest.exe and it has generated the below dlls and exes along with uninstall exe in the path (\Program Files\PowerTest)
But when I am running the executable it is not opening the application (It is not responding)
Below is the complete code: (PowerTest.nsi)
; PowerTest.nsi
;
;
; It will install PowerTest.nsi into a directory that the user selects.
;--------------------------------
; The name of the installer in the path C:\Program Files\PowerTest
Name "UPowerTestPSTest"
; The file to write in the path E:\Source
OutFile "PowerTest.exe"
; The default installation directory in the path C:\Program Files\PowerTest
InstallDir $PROGRAMFILES\PowerTest
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically) It shows the path the path C:\Program Files\PowerTest
InstallDirRegKey HKLM "Software\PowerTest" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "PowerTest(required)"
SectionIn RO
DetailPrint "PowerTest"
; Set output path to the installation directory. Here is the path C:\Program Files\PowerTest
SetOutPath $INSTDIR
; Give the dll and exe path
File E:\Source\PowerTest.exe
File E:\Source\testutil.dll
File E:\Source\ntutil.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\PowerTest"Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "DisplayName" "NSIS PowerTest"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\PowerTest"
CreateShortcut "$SMPROGRAMS\PowerTest\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortcut "$SMPROGRAMS\PowerTest (MakeNSISW).lnk" "$INSTDIR\PowerTest.nsi" "" "$INSTDIR\PowerTest.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest"
DeleteRegKey HKLM SOFTWARE\PowerTest
; Remove files and uninstaller
Delete $INSTDIR\PowerTest.nsi
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\PowerTest\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\PowerTest"
RMDir "$INSTDIR"
SectionEnd
Please let me know what i have missed. And also do we need to add anything to launch the application? Please suggest if there are any changes from the .nsi text script file i have provided.
Your CreateShortcut
call is wrong, it points to a .nsi file. It should point to $InstDir\PowerTest.exe
.
Your Delete
call is also wrong, deleting a .nsi makes no sense, it should delete your .exe and .dll files.
NSIS should not make a difference whether your application works or not, the issue is most likely somewhere else. Perhaps you need to register the .dll files or some other configuration change.