Every developer needs to have an Installer software solution to automate the install and un-install of their application. There are many different solutions that vary in price, features and ease of use. My preference is the open source tool NSIS used by many open source packages such as WinAmp and WireShark. I love its flexibility and user community but it probably isn't the easiest installer tool to use but I have to confess that I don't have enough experience with other installers to say that NSIS is the "answer".

Installers seem to be a very personal developer choice - perhaps, like me, most developers primarily have experience with only one or two installers. But I've listened to enough disgruntled InstallShield programmers to know I won't be considering that as an alternative. But I won't hesitate to encourage you to check out SageKey Software, a very well respected installer among Access developers.

Tiger Cubs

The gestation period for tigers is 100 days, but ranges from 93 to 111 days. After this time she will give birth to a litter of between 1 and 7 blind cubs, the norm being 2 to 4.

The cubs will be born in an area of heavy cover; this may be a cave, long grass, thick bushes, an overhanging rock, or a hollow log. Anywhere that won't flood, provides protection, shelter and a good degree of concealment will suit the purpose.

It is not unusual for at least one cub to die at birth. This is normally the runt of the litter which, even if it survives the birth, will probably die later of starvation, or be crushed. As the weakest of the litter they very rarely live long enough to venture outside, but when they do they become prime targets for predators. Captive tigers do not have this problem; most of their cubs will survive due to hand rearing.

Tiger In Water

NSIS Sample Installer Script


Template Script for Building NSIS Installer

NSIS is a very powerful Install tool that uses a user-defined script to build an installation package, typically an executable named SETUP.EXE. This sample script will not provide enough info on how NSIS works; you can find that info on the NSIS site. Rather my intention is to provide an example script that is usable for simple installation needs. Installers should be integral tools in your software deployment strategy as they automate the important process of installing and un-installing and minimize the potential for failed installs, corrupted or useless registry entries and provide a way to easily un-install the application without "messing up" the user's computer.

This script is a general template for creating an install package for a FE/BE Access application. The end result is a SETUP.EXE file that guides a user through the installation process. It leaves uninstaller registry hooks so that the app can be un-installed through the Add/Remove Programs icon in the Control Panel or by an Uninstall link.

There are perhaps seven lines of defines near the top where you provide your specific info. You'll need to provide the names of the files to install elsewhere in the script.

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "<Enter Product Name e.g. TheBomb>"
!define PRODUCT_VERSION "<Enter version e.g. 2.1>"
!define PRODUCT_PUBLISHER "<Enter your company name>"
!define PRODUCT_WEB_SITE "<Enter product website>"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define EXECUTABLE "<define executable file e.g. TheBomb.mdb>"
!define PROGICON "<define your icon file here e.g. theBomb.ico>"
!define SETUP_BITMAP "<define a bitmap file here for display by installer e.g. theBomb.bmp>"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "$PROGICON"
!define MUI_UNICON "uninstall.ico"  ; define uninstall icon to appear in Add/Remove Programs

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "license.txt"   ; text file with license terms
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"  ; readme.txt file for user
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\$PRODUCT_PUBLISHER"
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
  SetOutPath "$INSTDIR"

  setoverwrite off		; do not overwrite these files if they exist
  File "BackEndDataTables.mdb"

  setoverwrite on			; overwrite these files 
  File "FrontEndApp.mdb"

  SetOverwrite ifnewer		; only overwrite these if this installer has a newer version

  File "license.txt"
  File "readme.txt"

  CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
  SetShellVarContext all
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXECUTABLE}" "" "$INSTDIR\${PROGICON}" 0
  CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXECUTABLE}" "" "$INSTDIR\${PROGICON}" 0
SectionEnd

Section -AdditionalIcons
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
  SetShellVarContext all		; scope is "All Users"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
  WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Product" "${PRODUCT_NAME} ${PRODUCT_VERSION}" "$INSTDIR\uninst.exe"
  
  ;Exec "$INSTDIR\dbUpgrader.exe"  ; this would run a post-install program you provided
SectionEnd

Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
  Abort
FunctionEnd

Function .onInit
  SetOutPath $TEMP
  File /oname=setup.bmp "${SETUP_BITMAP}"

; optional
; File /oname=spltmp.wav "setup.wav"

  advsplash::show 1500 500 500 -1 $TEMP\setup

  Pop $0 ; $0 has '1' if the user closed the splash screen early,
         ; '0' if everything closed normal, and '-1' if some error occured.

  Delete $TEMP\setup.bmp
;  Delete $TEMP\spltmp.wav
FunctionEnd

Section Uninstall
;  UnRegDLL "yourRegistered.dll"

  Delete "$INSTDIR\${PRODUCT_NAME}.url"
  Delete "$INSTDIR\uninst.exe"
  Delete "$INSTDIR\readme.txt"
  Delete "$INSTDIR\FrontEndApp.mdb"
  Delete "$INSTDIR\BackEndDataTables.mdb"
  Delete "$INSTDIR\${PROGICON}"
  Delete "$INSTDIR\license.txt"
;  Delete "$INSTDIR\dbUpgrader.exe"

  SetShellVarContext all
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Help.lnk"
  
  Delete "$DESKTOP\${PRODUCT_NAME}.lnk"

  RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
  RMDir "$INSTDIR"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  SetAutoClose true
SectionEnd

I intend to expand this sample in the future showing how to install the .NET Framework or the Access Runtime package.

I recommend the use of HM NIS EDIT for creating NSIS install scripts.