Introducing Visual StudioInstaller
VisualStudio Installer is a free tool from Microsoft for creating installations forWindows applications. Visual Studio Installer is available in two Englishversions: version 1.0 works on Windows 98 and version 1.1 works also on WindowsME and 2000/XP. You can download version 1.1 from
Before installing Visual Studio Installer (fromhere on just VSI) be sure that on your PC has been installed Visual StudioService Pack 3 or later. You can download Visual Basic Service Pack 5 from
The on-line documentation and MSDN articlesshow the differences between VSI and the Installation Wizard accompanyingVisual Basic. VSI offers more features that will be shown in this article. Supposingyou have installed both Visual Studio Service Pack and VSI, you are ready to goforward.
WindowsInstaller
VSI is based on the Windows Installertechnology. Windows Installer is an engine using files with .MSI extension forinstalling applications. Every .MSI file is a kind of database and containssetup informations and compressed files. Windows Installer is part of theoperating system in Windows ME and later versions. If you have Windows 95/98you can download the latest version of Windows Installer at
Asimple package
First of all you have to create a new setupproject. Visual Studio Installer can create three kind of projects:
1. A new empty project;
2. A so-called Merge Module;
3. Visual Basic Installer;
A MergeModule (extension is
For Visual Basic programmers the most importantoption is the third one. Select this and specify an existing project.
If you select the first option in the nextdialog box:
theinstaller will run on any operating system in any language; otherwise,selecting the second option, the installer will only run on operating systemslike yours. The installer can run only with English dialog boxes.
VSIwill create a new project, read VB project dependencies adding them to the VSIproject, and create a list of files to be installed. This list will appear atthe right side of the screen, in a section called Files. You can get the best result from setup customizing thefollowing properties: User Interface,File System, Registry Entries, Associations.
Fromthe Project menu select the lastcommand, containing the project name and the word properties. The following dialog box will appear, where you canspecify or modify package properties:
thereare some properties to be configured:
1.
2.
3.
4. compression:you can choose between standard Installer (suggested), cabinets (.cab) oruncompressed. You can also set the compression method, by speed or by size;
5.
6.
7.
8.
9.
Managingfiles is the hardest argument. Open the FileSystem item. In the central window you will see a list of folders. Eachfolder contains some files, or just some shortcuts.
TheWindows System Folder contains DLLlibraries or ActiveX components which have to be registered by the installer.This is the right location for other files that must be placed in WindowsSystem directory.
Toadd one or more Windows special folders (ie: Windows, Application Data etc.)right-click and select Add Special Folderthen select the special folder you need.
Executables,type libraries, text documents, images, and all files needed by yourapplication must reside in the ApplicationFolder. You can also create sub-folders and add new files there, with just amouse right-click.
BecauseVSI reads VB project dependencies, you do not need to add components or systemfiles in File System, except forthose files that VSI cannot read from the source project (like documents,databases, etc.).
Youcan add shortcuts in the User’s StartMenu and User’s Desktop folders,with a mouse right-click, just selecting CreateShortcut.
Selectthe shortcut destination from the file list. You can also specify some morefeatures, first of all the shortcut icon. This necessary since VSI gets iconsonly for executables, so for other file types you must specify an icon.
Inthe Description property you can addcomments, so that users can see a description when choosing the
Tocreate folders and shortcuts in the Windows StartMenu, right-click on File System onTarget Machine, and select AddSpecial Folder and then Custom.VSI will create a new sub-folder called NEWFOLDER. Renamethis folder in ProgramMenuFolder.Write folder name exactly as shown. This is a Windows Installer constant, usedto identify that particular folder. This new folder is the Program Files folder in the StartMenu.
Now,you can add a new sub-folder under ProgramMenuFolderand name it as you like, adding here shortcuts as shown before.
Atthe bottom of the screen you can see the TaskList. Once completed the above operations, select the Build command from the Buildmenu. VSI will begin to create the installer. If nothing appears in the tasklist it means that the package has been created with no errors.
Thetask list can display simple warnings or critical errors. In the latter case,you will see the Failed message
Avery simple but frequent error is to add duplicate filenames in the
Warningsare not often important, anyway you should verify the reason why they wereissued. The most frequent warning is about DLL versions. It is possible thatyour operating system contains DLLs with different version than those used byVSI for creating packages. Since VSI uses its own merge modules containingsystem and run-time libraries, it will just emit warnings about components withdifferent versions. You can leave things unchanged, since VSI will notoverwrite later versions of the same components.
Otherwarnings can be related to the lack of dependencies for type libraries, dynamiclink libraries or ActiveX components. If you have no dependencies file(particularly for your own type libraries), you should control the source code,if possible, and verify that each file required by your component is includedin the package.
Forexample, your application has a reference to a certain type library, but you haveno dependecies file for this component; in this case VSI shows a warningmessage, and you must be sure that all the required libraries are included inthe File System, (in this case VSIcannot rely on dependencies), because otherwise the application will not workon machines that don’t contain components required by the type library. Here’s asample task list:
Youare now ready to build your own package. From the Build menu you have to select the Rebuild command. VSI will create a Windows Installer package; ifyou chose Installer with InstallerLoader from the Project Properties window, VSI will copy Windows Installerredistributables in the package output folder. From the Project menu, choose LaunchInstaller to test your package. Before distributing your installer,remember to set package configuration to Releasefrom the Project Properties window.
Themain purpouse of this article is not to be a guide to VSI, rather just astarting point, since it is quite hard to find documentation about VSI on theInternet.
Youcan also download the
Contact me at my e-mail address: