This tutorial will guide you step by step into the creation and customization of a Advanced Installer Professional project. It is addressed to those who have completed the Simple Installation tutorial.
Let's suppose you want to create a package for a text editor you have created. We will use for this role Microsoft's Notepad. This editor has some characteristics:
- For the editor to function properly some registry keys must be present on the target system.
- Suppose this editor is developed using Visual Basic. In order to work, it needs Visual Basic 6 Runtime to be installed on the target machine.
- It has a type of file that it associated to, called, say, EDI file.
- 1. Create project
- 2. Enter product details
- 3. Set install parameters
- 4. Add files and folders to your project
- 5. Add registry keys and values to your package
- 6. Set launch conditions
- 7. Add Prerequisites
- 8. Create new file extensions and make file associations
- 9. Build and Install
- 10. Organize your application into features
- 11. Set dialogs to guide the user during install
- 12. Set package name and some more media options
- 13. Add environment variables to your project
- 14. Add custom actions to your installation package
- 15. Install and control services
- 16. Add merge modules to your project
- 17. Set the UI appearance of your installation package
If Advanced Installer is not currently running, launch it by double-clicking a desktop icon or selecting it from the “Start” menu. When the application starts, you will see a dialog where you can choose the type of the project you want to create.
Select Professional and press the Create Project button. The new project has been created and from now on you will edit it.
Save the project and give it an appropriate name - let's say "Tutorial" for this example.
English is the default project language, but you can change it to any of the languages known by Advanced Installer.
Now you can see the main view split in two panes. In the left pane, you can see all the options you have to edit in your current project, grouped in four categories.
Click on “Project Details” option from the “Product Information” group to set the information seen by the user for your installation package. Fill the fields in the right pane with the corresponding data. Here is an example of how this can be done:
For further information about this page please see Product Details Tab.
You now have the general information on the Product Details page filled in.
Go to the Install Parameters page (click the Install Parameters option).
Set the default installation paths for the "Application Folder" and "Application Shortcut Folder" by using the combo boxes or thebutton. You can edit these fields, but the values from the combo boxes are the most common ones.
For more information about these paths please see the Install Parameters page.
The next step is to add to the project the files and/or folders that compose your application. You will need an EDI file to test the editor's file associations. Since it is a custom type of file, you will have to create it. Use any text editor to create a "foo.txt". Then rename it "foo.edi".
Select “Files and Folders” from the “Resources” menu on the left pane.
Click on thetoolbar button and select the files of your application. For this example choose Notepad.exe from your Windows directory. Repeat this step to include the Foo.edi file you have created. You can add in this way as many files as you want.
Once the files are added, their name will appear in a list in the right-side pane of the view. Now let's make a shortcut to the Notepad.exe file you just added. Right click on this file and choose “New Shortcut To -> Installed File”. In the newly appeared dialog choose a name for your shortcut and a location - like in the following screen-shot. Press the OK button and the shortcut will appear listed in the application shortcut folder.
For more information please see the Files and Folders page.
Let's suppose that your application needs two registry entries. These are located in the "Software\[Manufacturer]\[ProductName]\Settings" key.
- One registry value is named "AppPath" and stores the path where your application is installed.
- The other one is named "AppSettings" and contains a value that shows the current settings of the application. On install it has the value "36".
Select the “Registry” page.
In the tree, select the "Software\[Manufacturer]\[ProductName]" key.
Click on thetoolbar button to create a key. Edit the key name to "Settings".
Add a value for it using thetoolbar button.
In the "Name" text field enter the name of your first key: "AppPath". Use the Formatted Type text field the value that it contains will be expanded at install time into the full path to your application's location.button and select "Application Folder". Since "Data" is a
Use the same steps to create the "AppSettings" value. This time when creating the new key select "Binary" and type in the "Data" field the number "36".
Once the registry keys and values are added, you can see them in the right-side pane of the view.
For more information please see the Registry page.
Go to the "Launch Conditions" tab of the "Launch Conditions" page. If you wish that your application should be installed only on Windows NT 4.0 or higher and not on Windows 9x/ME, then you should do the following:
- uncheck the "Windows 9X from" check box
- check the "Windows NT From" check box
- select "Windows NT 4.0" from the associated combo box
You can also create a custom launch condition which will make sure that the package will not be installed if the file "example.txt" does not exist on the partition on which Windows is installed. For this you can follow these steps:
- create a File search in the Search page
- set the file name to example.txt
- rename the search to FILE
- use the context menu to add a folder as the location of the search
- set this folder to [WindowsVolume] (this is resolved to the partition on which Windows was installed)
- use the "Test Search" button on the toolbar to test the search
- go to the Custom Launch Conditions tab in the "Launch Conditions" page
- use the button to add this launch condition:
Description: This application cannot be installed because the file "C:\example.txt" does not exist.
Let's suppose that your application requires the "My Application.exe" installation package to be installed. This package will install an application and it will create the registry entry HKEY_LOCAL_MACHINE\Software\My Application\Version with the value 1.0. If this application is not already present on the target machine, your package will have to install it before deploying your application. For this you can use the "Prerequisite" feature.
Go to the "Prerequisites" page.
You can add any software that you need. Advanced Installer also comes with a list of common used prerequisites, for which all the settings are already defined. After creating them, you only have to specify the source for the setup file.
Select "New Package Prerequisite" from the context menu. If you have the "My Application.exe" installation package on your computer you can use the "Use files from disk" option and select it when prompted.
You can also set the location of the prerequisite as an URL from where the file can be downloaded.
After the properties of the prerequisite have been set you need to set the detection criteria by using the Install Conditions tab.
Since the prerequisite application, let's say, creates a registry entry, we can use it as a detection criteria in the Searches section.
For more information please see the Prerequisites page.
Your application uses files with a particular extension (in our example that is "edi"). You may want to associate that type of files to be opened or edited with your application. Advanced Installer helps you do this in a very simple way.
Choose “File Association” from the “Resources” options group.
Use thetoolbar button to create a new extension: "edi". Enter a description of this extension in the appropriate field in the right-side pane. You may choose an icon to be displayed for all the files with the extension you created.
For every extension contained in your application, you need to add at least one verb. The name of the verb will be seen in the context menu that appears when you right click on a file of "edi" type in Windows Explorer. For this example, you should leave the defaults settings. The effect is that when you double click a file or you choose the "Open" action from a context menu of an "edi" file, the application is automatically launched with the command line argument specifying the absolute path of the chosen file.
You can add as many verbs as you want for an extension.
For more information please see the File Associations page.
You are now ready to test your program. Build and install your program as described in the Simple Installation tutorial.
You can test if the file associations are working properly. Look in the folder where you have installed the program and double-click the EDI file. This should open using the Notepad.exe file that you have installed.
Also you can verify the value written in the registry (using Regedit.exe). You will see the value of AppPath containing the full path to your application.
You may want to give the user the possibility to install only some parts of your application. To do this you must organize you application into several features.
To see the structure of your application select the Organization page on the left pane.
At this moment, all your files are included into a single feature, called "MainFeature". You will create a new feature that contains the "foo.edi" example file. In the "MainFeature" only the "Notepad.exe" component will be present.
Select "Product" in the tree and click the "New Feature" toolbar button.
Drag and drop the "foo.edi" component in the newly created feature. To make this feature optional (i.e. to be installed only on Custom or Full types of installation) select in the "Install Level" field the "4 (Complete)" option.
Your organization page should look like this.
For more details about features and components please see the Organization page.
Go to the Dialogs page.
Here you can select the dialogs that appear during install. In our example, you will add two more dialogs:
- A dialog in which the user to choose the type of installation (Typical, Complete, Custom).
- A dialog for displaying a license agreement text. You also will allow the user to choose to view the ReadMe file or to launch the application at the end of the installation.
For the first goal, right click the Welcome dialog from the left-side pane and choose “Add Dialog” from the context menu. Select the “SetupTypeDlg” dialog.
For the second goal, repeat this procedure but select the “LicenseAgreementDlg” dialog from the “Add Dialog” window. Click on thebutton from the right-side pane to select from your machine the Rich Text Format file containing the license agreement. Finally, you must add to your package the ReadMe file for your application (use the “Files and Folders” option page). Select the “ExitDialog” dialog from left-side pane. In the right-side pane, check the “Show "View ReadMe" option” checkbox; you will be prompted to choose the ReadMe file of your application. Choose the file you just added to your package. Next, check the “Launch Application at the end of installation” checkbox and select from your package the application that will be launched at the end of the installation.
Note that the user can choose not to see the ReadMe file or to launch this application.
For more information please see the Dialog Editor page.
Build and test the package again.
The Advanced Installer project file only contains a description of how to build your MSI installer, and does not actually include any files.
In this step you set the name of the package that will be generated.
Select the “Media” page from the left-side pane and navigate to the Configuration Settings Tab. Set "MyPackageName" in the "MSI name" text field. If you let this field empty, the name of the package will be the same as the name of your project.
For more details about the available options please see the Media page.
Let's suppose your application needs some information stored in an environment variable. In this step you will add to your project this type of variable. In our example, we will add a variable - "NOTEPAD_PATH" - that will contain the path to the folder in which your application will be deployed.
Select “Environment” from the “System Changes” options group.
Click on thetoolbar button and fill the fields of the newly appeared dialog as in the next screenshot.
For more information please see the Environment Variables page.
Select “Custom Actions” option from the "Custom Behavior" group in order to add a Custom Action. Select the "Install Execution Stage" -> "Add Resources" action group in the left-side pane. Choose from the toolbar “Launch installed file”. Select from the FilePicker dialog the "Notepad.exe" file (you included this earlier in your project).
In the command line field pass the string "foofile". The effect is that Notepad will try to open this file; if "foofile" doesn't exist on the target machine, Notepad will ask the user whether it should create a new one. This shows the way the command line arguments behave.
For more information please see the Custom Actions page.
In this step, we will define the services to be installed with your application. You can only install services that are part of your package.
First, use the “Files and Folders” option to add the service file (a native Windows service) to your project.
Go to the “Services” page from the “Resources” option group.
Click on thetoolbar button. Select the service file from the dialog that appears and fill the service properties fields as in the screenshot below.
You can control your service or any other service installed on the target machine during installation. The above operations installed both the service and the service control. The following screenshot shows you exactly the control service operation parameters.
Let's suppose you install an application that requires Microsoft C Runtime Library. The logic and files that compose this library already exist in the merge module. You can include this module in your package and it will be installed with your application. This way, you are sure your application will work on every machine. With Advanced Installer it is very easy to add a merge module to your package.
Choose “Merge Modules” from the “Requirements” options group
Click on thetoolbar button and browse to your msm file. That's all!
For more information please see the Merge Modules page.
In this step we will change the UI appearance of the package.
Go to the "Themes" page in the "User Interface" group.
In the "Preview" tab you can change the banner showed on the dialogs and the background from the first and the last dialog. You can choose one of the Advanced Installer predefined images or you can use one of your own by expanding “More options” and double-clicking “DialogBitmap” or “BannerBitmap”.
For more information please see the Themes page.
This concludes our tutorial. To learn more, please read the Other Languages tutorial.