|Simple project tutorial|
|Written by Administrator|
|Monday, 11 May 2009 09:51|
This tutorial describes how to make a simple Ghost Installer Project. Simple project is a project that contains only one feature, the user cannot choose what is going to be installed. If you want to make a project that contains several features so the user is able to choose options that will be installed, please see Creating multi-components installation tutorial.
In this tutorial we will create the following project:
1. The application is an E-mail client. There is a main executive file (SmartMail.exe), configuration file (SmatMail.ini) and Help file (SmartMail.chm)
2. The application needs two dynamic libraries: smtp.dll and pop3.dll. These libraries should be placed to windows system directory.
3. There are different versions of the libraries for NT and non-NT versions of windows.
So, the first step is starting the gDesigner IDE. The dialog with project templates should appear. Choose Simple project template, as shown on the picture and press OK
Now we must define some project settings:
Now we have to add some files to the project. Before we add files to the project, here are some facts you should now.
The new files and components structure of the Ghost Installer is compatible with Windows Installer and has the following model: the component contains files and defines, which folder they will be installed to. Files from the same component can be installed into the component's folder and folders which are inside of the current component's folder. The current component can be changed on the main panel:
As soon as the application needs some files in windows system folder, we will create a new component for those files. To do that, go to Deployment > Packages and Components. Press "New Component" button and select the component destination from the list, or type your own destination:
Now we can proceed to adding files. Go to Deployment > Files, select the component, as shown in the previous step and press "Add Files" button and select files to add:
After you've selected the files you want to add to current component, the Ghost Installer will prompt you which way you prefer the source path to be stored in the project. It doesn't matter, which way you will choose, they all point at the same location. After that the file dependency manager will appear and show which files are required by the file(s) you've just added:
In this dialog all files that are needed for just added .exe or .dll are shown. You can select the destination of the dependent files. Usually the first option is alright (the selected files will be copied to Windows System directory), unless you know the exact position of the dependent file. This dialog can be called later by selecting Scan for dependency files from the context menu.
We have to add SmartMail.exe, SmatMail.ini and SmartMail.chm files to the main component, and both versions of the dlls to Component1.
Now we have to tell the Ghost Installer to install the correct versions of the dynamic libraries for different versions of windows. To do that, we have to define conditions for those files. Condition is an expression, that defines whether the item will be processed during the installation. We have to pairs of dlls - for NT based windows (win2000, XP) and for non-NT based windows. There is a system variable OSPlatform, that contains the windows platform identifier. When the installation is started on Windows 2000 (or XP), it contains "NT" string, otherwise it contains "9X".
To apply the same condition to several files at a time, we have to select those files, clicking on them while holding the Ctrl key. Let us select, for instance, the NT base files. Then we have to go to Condition Tag and type the following condition: %OSPlatform%="NT".
The condition for the other pair of files is defined the same way. The only difference is that the condition is %OSPlatform%="9X" or not %OSPlatform%="NT" in this case.
If you want your installation to contain Read Me and License Agreement dialogs, then place Readme.txt and License.txt (or .rtf) files in Presetup files folder. If you have read me and license files for different languages, make their extensions the same as their languages' IDs, for example License.ENU, License.ITA, etc. To do that, select Presetup files folder, press Add files button and find those files. Those files will be used later in Step 7.
Now you can make shortcuts for the installed files. Go to Shortcuts tool and select the Application files component. Select %ProgramGroup% element in Current User tree, Press Add shortcut button, and the shortcut will be added. This shortcut needs a proper target, so press the button in the Object field and select the executable. Then change the Working Directory, make it the same as the executable's destination directory.
Now you have to select what dialogs will be shown during the installation. Go to User Interface tool. In this tool you can define the sequence of the dialogs and edit the dialogs.
Before Installation sequence contains all dialogs, that are shown before the files are copied. Installation Progress Dialog contains the dialog, that is shown when the files are copied. After Installation sequence is shown after copying files if the installation was completed successfully. Finish Installation will be shown after the installation process if it failed, or after the After Installation sequence. Selecting a dialog in a sequence will cause a dialog preview. Drag the dialogs to form the desired installation and uninstallation sequences.
If you have chosen to show License or Read Me dialogs (or both) you have to specify the files for those dialogs. If you have read me and license files for different languages, make their extensions the same as their languages' IDs, for example License.ENU, License.ITA, etc. Then select License Dialog in the Before Installation sequence. Select Quick Properties tab below, select License File property and type %presetup%\license.%LangID% as shown on the picture below. If you have a single file for all languages, then type the name of that file, for example %presetup%\license.txt. The same actions should be performed for ReadMe dialog.
The Project is ready! The last thing left is to build the project. To build a project, press Build Project button or F7 key. Then press Build button and wait for the project to be built.
Congratulations!!! The project is built. Now you can press Browse button to move to the folder where Setup.exe was created, or you can press Run button to see, how the installation works. Don't forget to save your project after you close the dialog.