Category:Tutorials. Embedding other installers. Oftentimes one runs an installer that contains installers for other programs.
For example, I wrote an application for a client that has a pocket PC component. The installer I wrote for them also installs Active Sync, the .NET CF Version 2 redistributable, and ntbackup being many of the machines run XP home edition. This page demonstrates how to do this. Rather than lecture theory first, let's jump right in with an example snippet. This demonstrates 2 techniques, prompting the user for permission and checking for the existence of a file to determine whether to install an msi. ; These are the programs that are needed by ACME Suite.Section -Prerequisites SetOutPath $INSTDIR\Prerequisites MessageBox MB_YESNO "Install Microsoft ActiveSync?
" The process is simple. This is the bit of code I have been using for installing dotnet 2 where needed. This is a real world example. . ; Script generated by the HM NIS Edit Script Wizard. ; HM NIS Edit Wizard helper defines! Get directory of installed .NET runtime. Description Given a .Net version number, this function returns that .Net framework's install directory.
This is useful if you intend to call 'RegAsm.exe', or 'GACUtil.exe' on one of your .Net assembly DLLs, since these executables are stored in the directory this function returns. Parameters in: version of .Net framework required (eg. "v2.0")out: directory in which it is installed (eg. Returns "" if the specified version of the .Net framework does not appear to be installed. Usage Section "Install" ; get directory of .NET framework installation Push "v2.0" Call GetDotNetDir Pop $R0 ; .net framework v2.0 installation directory StrCmpS "" $R0 err_dot_net_not_found ; Perform our install ; e.g. use the .Net path in $R0 to call RegAsm.exe SetOutPath $INSTDIR File "MyDll.dll" ExecWait '"$R0\RegAsm.exe" MyDll.dll' Return err_dot_net_not_found: Abort "Aborted: .Net framework not found.
" Function. Register a managed .NET DLL in the GAC. The Function ; Function: AddManagedDLL; Author: Joe Cincotta ( joe@pixolut.com ); Date: 27/7/2004; Bug fix by Alessio Saltarin ( ); Register a .NET managed DLL in the Global Assembly Cache (GAC).; And make it appear in the VS IDE 'Add References' dialog.;; Rewrite by Joe Cincotta 7/6/2005;; NOTE: This version expects .NET 1.1, if you require older 1.0 ; then ensure you change the framework path...; ; Use by passing the full path of the DLL and the Assembly Name.; Make sure you remove the RegKey when performing uninstall!
Issues The location of executables such as 'GACUtil.exe' may vary, depending on the version(s) of the .Net runtime installed on the target machine. Instead of hard-coding a path to such utilities as above, you could use a function to determine this information at install-time, such as Get directory of installed .NET runtime. - Add reference to System.EnterpriseServices assembly and. Tutorial: Create a NSIS install script - Tutorials - Learn - Features. Nullsoft brought us many good things in the years before Justin Frankel split - WinAmp, Waste and Gnutella to name a few, as well as a plethora of lesser known projects.
One that doesn’t get nearly enough attention is NSIS – the Nullsoft Scriptable Install System. With this wonderful tool you can create your own install programs, without having to fork out hundreds for the hideously over priced Wise or InstallShield packages. *Editor's note* Any code is displayed here as bold text. Install! HM NIS Edit: A Free NSIS Editor/IDE. NSIS Wiki.