NSIS installer package and another question too!!

Started by
0 comments, last by MJP 15 years, 9 months ago
Hi, i doubt this is the right forums but here i go anyway. I finished my connect 4 ripoff and am in the process of creating an installer, well i found this one NSIS scriptable. I have the game installing fine and dandy and it adds it to the add/remove like any other program, however i'm trying to get the directx runtime to run silently when the user installs the program but its not happening. Here is the code, i thought this is how it would be done but apparantly not.

# define name of installer
outFile "FIAR Setup.exe"

# define installation directory
installDir "$PROGRAMFILES\MooseMan Studios"
installDirRegKey HKLM "Software\MooseManStudios\FourInARow" "Install_Dir"

RequestExecutionLevel admin

# start default section
section

	# set the installation directory as the destionation for the following actions
	setOutPath $INSTDIR

	# create the uninstaller
	writeUninstaller "$INSTDIR\uninstall.exe"

	# install dx runtime before installing game files
	file "Redist\bdant.cab"
	file "redist\bdaxp.cab"
	file "redist\dsetup32.dll"
	file "redist\dxnt.cab"
	file "redist\dxupdate.cab"
	file "redist\mar2008_d3dx9_37_x86.cab"
	file "redist\mar2008_d3dx10_37_x86.cab"
	file "redist\mar2008_x3daudio_x86.cab"
	file "redist\mar2008_xact_x86.cab"
	file "redist\mar2008_xaudio_x86.cab"
	file "Redist\dxsetup.exe"
	file "Redist\dsetup.dll"
	ExecWait "$INSTDIR\dxsetup.exe/silent"

	# now delete the dx runtime files to clear up space in folder
	delete "$INSTDIR\bdant.cab"
	delete "$INSTDIR\bdaxp.cab"
	delete "$INSTDIR\dsetup32.dll"
	delete "$INSTDIR\dxnt.cab"
	delete "$INSTDIR\dxupdate.cab"
	delete "$INSTDIR\mar2008_d3dx9_37_x86.cab"
	delete "$INSTDIR\mar2008_d3dx10_37_x86.cab"
	delete "$INSTDIR\mar2008_x3daudio_x86.cab"
	delete "$INSTDIR\mar2008_xact_x86.cab"
	delete "$INSTDIR\mar2008_xaudio_x86.cab"
	delete "$INSTDIR\dxsetup.exe"
	delete "$INSTDIR\dsetup.dll"

	# write the game files out to the install directory
	file "Four In A Row.exe"
	file background.tga
	file credits.jpg
	file intro.jpg
	file mainmenu.jpg

	# create a shortcut named "Four In A Row" on the desktop
	# point the new shortcut at the program executable
	createShortCut "$DESKTOP\Four In A Row.lnk" "$INSTDIR\Four In A Row.exe"

	# create a shortcut named "Four In A Row" in the menu folders
	CreateDirectory "$SMPROGRAMS\MooseMan Studios"
	createShortCut "$SMPROGRAMS\MooseMan Studios\Four In A Row.lnk" "$INSTDIR\Four In A Row.exe"
	createShortCut "$SMPROGRAMS\MooseMan Studios\Uninstall.lnk" "$INSTDIR\uninstall.exe"

	# write to system registry for add/remove functionality
	WriteRegStr HKLM SOFTWARE\MooseManStudios\FourInARow "Install_Dir" "$INSTDIR"

	# write uninstall strings
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FourInARow" "DisplayName" "Four In A Row (remove only)"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FourInAROw" "UninstallString" '"$INSTDIR\uninstall.exe"'
sectionEnd

# uninstaller section start
section "uninstall"
	
	# first, delete the uninstaller
	delete "$INSTDIR\uninstall.exe"

	# delete all the game files
	delete "$INSTDIR\Four In A Row.exe"
	delete "$INSTDIR\background.tga"
	delete "$INSTDIR\credits.jpg"
	delete "$INSTDIR\intro.jpg"
	delete "$INSTDIR\mainmenu.jpg"

	# delete from teh system registry
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FourInARow"
	DeleteRegKey HKLM "SOFTWARE\MooseManStudios\FourInARow"

	# second, remove the link from the desktop and start menu
	delete "$DESKTOP\Four In A Row.lnk"
	delete "$SMPROGRAMS\MooseMan Studios\Four In A Row.lnk"
	delete "$SMPROGRAMS\MooseMan Studios\uninstall.lnk"
	RMDir "$SMPROGRAMS\Mooseman Studios"

	RMDir "$INSTDIR\MooseMan Studios"
	RMDir "$INSTDIR"

# uninstaller section end
sectionEnd

what am i doing wrong with the dx runtime install? And to my other question, i sent this to one of my former teachers from high school and he installed it on his computer but when he launches it he said he gets the error "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." I know that it is the release build because all the other computers that i ran it on run fine, although all of them that i know of are vista, could it be something is missing from XP that he runs?
Advertisement
I'm not familiar with NSIS, but perhaps this:
ExecWait "$INSTDIR\dxsetup.exe/silent"

should be this?
ExecWait "$INSTDIR\dxsetup.exe /silent"



As far as your error...that means that your executable depends on a DLL that isn't present on the PC. It doesn't look like you're including the Visual C++ Runtime with your app...you should be including the redistributable that corresponds to the version of VC++ you're using. There's one for 2005, one for 2005 SP1, and one for 2008. Include that in your installer, and you can launch it the same way as the DX Redist.

This topic is closed to new replies.

Advertisement