Create Firefox.msi with AdvancedInstaller

This page shows how you can create MSI-files yourself, only using free software. These are true MSI-files, not wrappers around the installer.exe, thus they offer reliable install, clean uninstall, and even the repair option.

Included are some some configuration changes suggested for Firefox 3.6 and 10-esr. They disable automatic update, disable the message telling that all versions of Firefox 3.6 are outdated, and declare Firefox as default-browser for all users (version 3.6 only, in version 10-esr you have the choice) by setting the respective registry-values in HKLM instead of HKCU.

What about other versions and Thunderbird?
The basic principle hasn't changed from version 3.6 to 10. I plan to update this webpage for version 17-esr, if that requires some change. The same method can also be used for Thunderbird 10esr. I won't describe this here, but right now I'm preparing how to create Thunderbird.msi with WiX. That works for Firefox and Thunderbird, ESR and Rapid Release versions. I recommend that you switch to that method.

latest news about version 17
I tested with Firefox 17 alpha, beta, and release. Almost everything still works the same. I'll offer a new registry file shortly, cleaner, created with a different method. You might want to use an extended version of the file mozilla.cfg to switch off some newly introduced features, and to work around a newly introduced problem (Firefox asks each new user for permission to set itself as default browser, even it already is declared as default for all users, see bug 780118). While it's not yet here, you can use the new file mozilla.cfg that I made for my description create Firefox.msi with WiX, contained in zip-archive firefox.msi.1.zip.

principle

Firefox works if one just copies the program directory with all its contents from %ProgramFiles% (typically C:\Program Files\Mozilla Firefox) from one computer to another computer (tested with versions 3.6 and 10). This is the first step that the MSI file needs to do.

Additionally Firefox should be declared as default browser (by setting some values in the registry), and its own automatic updater should be disabled (by adding two config files).

how?

This example uses the free version of the commercial program Advanced Installer. I used version 8.4, the current version may look a bit different, but probably not much.

Description

preparations

  • Install Advanced Installer and Firefox on a PC, both with default settings. You don't need a completely clean PC for that, as you would require if you would plan to use an imaging tool like WinInstallLE. Just make sure there's not already a Firefox directory in %ProgramFiles% before you start. It's not necessary to let Firefox declare itself as default browser or to run it once after installation, but it doesn't hurt either. If you don't run it, the resulting msi file will be slightly smaller, because the file compreg.dat will be missing.

create MSI-file

  • Run Advanced Installer
  • Click on "New", select Project-Type "Installer", scroll down the templates to "Generic Templates", double-click on "Simple" (this is the part of the program that remains free, even after the trial period).
  • Enter Product Details: Name "Firefox", Version, Company "Mozilla". I personally prefer to place checkmarks in the options "Disable Modify" and "Disable Remove".
  • Select "Install Parameters". You will be asked to generate an ID. Anwer Yes.
  • If you want your installations to use the original path name, make the parameters look like this:
    Application Folder: [ProgramFilesFolder]Mozilla Firefox
    Application Shortcut Folder: [ProgramMenuFolder]Mozilla Firefox
    

  • Still in "Install Parameters" select Install Type: per machine only.

declare files

  • Select "Files and Folders" and then "Application Folder".
    Open an explorer window next to the window of Advanced Installer and go to the program directory of Firefox.
    Select everything inside that directory, drag it into the white area in Advanced Installer and drop it there.

disable automatic update and update messages (highly recommended)

If you are responsible for deployment of software, you don't want the automatic updater to annoy your users, or to disturb your own distributions of updates. It wouldn't be able to do the update anyway, because your users don't have admin rights. Also the latest version of Firefox 3.6 shouldn't confuse your users by claiming that it's not the latest version.

  • download the file mozilla.cfg and drag it into "Application Folder"
  • download the file autoconfig.js and drag it into subdirectory defaults\preferences

If there is no directory defaults\preferences, don't use defaults\prefs (see bug 779437#c4), but create the required directory: Right-click on defaults, select 'new folder', select 'regular', enter the name 'preferences'.

disable import query (optional)

When Firefox is started the first time from a new user, it asks to import bookmarks etc. from other browsers. You might like that. If you don't:

  • download the file override.ini and drag it into "Application Folder"

(Not required if you declare Firefox as default browser for all usesr, see notes below)

declare shortcuts (recommended)

You should create a shortcut to Firefox in the programs menu. Optionally there should also be one on the desktop.

  • Still in "Files and Folders" click on the small + left of "Start Menu" to open that, then click on "Programs".
    In the second row of icons from the top click on the Icon "New Shortcut".
  • Select the file firefox.exe and click ok.
  • Go to the field "Name", enter "Mozilla Firefox", and click OK.
  • If you want another shortcut on the desktop, select "Desktop" (a little lower than "Start Menu"), and repeat the previous three steps there (click "New Shortcut", select file firefox.exe, enter name "Mozilla Firefox".

create registry keys (recommended)

  • For Firefox 10.0.x-esr only:
    Download either firefox10a.reg (for only the minimum registry entries), or firefox10b.reg (if you want to make Firefox the default browser for all users).
  • For Firefox 3.6.x only:
    Download firefox36e.reg (or firefox36d.reg for the german version). Both files make Firefox the default browser for all users.
  • Edit the downloaded file with notepad.exe and apply the following changes with the search and replace function. The first change is required for Firefox 10.0.x-esr and for Firefox 3.6.x. The changes 2, 3, and 4 are required only for Firefox 3.6.x. If you are unsure which data you should use, just run regedit.exe and look how that key is set on the computer where you manually installed Firefox.
    1. Replace all occurences of 'C:\\Program Files' with the path where Firefox got installed, without the part "Mozilla Firefox" (usually the same as the contents of your environment variable %ProgramFiles%), but use double \\ signs. For example in the german version of Windows XP it's 'C:\\Programme', in the english version it's 'C:\\Program Files'.
      This change is required because otherwise Advanced Installer will not recognize the correct paths during import, and replace them with its generic variables.
    2. Replace all '3.6.25 (de)' with the version number that you are installing plus your country code (look it up for one of the affected keys in your registry).
    3. Replace all '3.6.25' with the version number that you are installing.
    4. Replace all '1.9.2.25' with the version of Gecko that's in your version of Firefox. You probably only need to adjust the last two digits.
  • Select "Registry" (below "Files and Folders"), then "Import REG File". Select the previously downloaded and edited file.

finish

  • In the top row of icons click on "build" (looks like the image on the right here), and choose a path and a name for that project (I prefer to put it on the desktop and name it Firefox). Wait until the build-process has finished. If you have called your project Firefox, then you have now a file Firefox.aip and two directories: firefox-cache and firefox-SetupFiles. Open the latter one to find the file firefox.msi.

Use this file to deploy Firefox via GPO.



notes

  • The uninstall will not completely restore the registry to the previous state: it will not reactivate Internet Explorer as default browser. The normal uninstaller of Firefox makes Firefox only the default browser for the current user. Internet Explorer makes itself default for all users. If you uninstall Firefox, it removes the user setting, which causes windows to go back to the computer defaults. If Firefox is set default for all users, then uninstalling it will remove these entries, but the setting for Internet Explorer are not restored.
  • Making Firefox the default for all users has a side effect: if prevent it from automatically running the import agent when it's first run by a user. (This is not a bug in my registry file, it's also caused by the command "helper.exe /SetAsDefaultAppUser".) Remedy: The import can also be called manually in the 'file' menu.
  • After manually installing a MSI-file created with this method, Windows might not immediately know that Firefox is the new default browser. But if you deploy this with GPO, the installation will happen before a user logs in. In this case Windows should reload the registry and see the change.
  • This description does intentionally not utilize the install and uninstall features of helper.exe. This would require to set up custom actions in the MSI-file. Doing that is not advisable because it can too easily go wrong. You can even end up with an MSI-file that passes all your testing of install and uninstall, but it acts up on some of the other PCs, or it fails the uninstall is triggered by GPO as part of an update.
  • Setting Firefox as default browser can alternatively be done with different methods:
    • Ask your users to start Firefox manually. On its first run it will ask for permission to declare itself as default browser. This will set it as default only for that user.
    • Have this command run in account of all users:
      "%ProgramFiles\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppUser
      This will set it as default for these users.
    • create a "custom action" in the MSI-file to run the command
      helper.exe /SetAsDefaultAppGlobal
      This will make it default for all users.

changes:

  • 07-Nov-2012
    • more info about version 17, point to new file mozilla.cfg
  • 24-Oct-2012
    • part about using AdvancedInstaller moved here from main page
  • 03-Aug-2012
    • use defaults\preferences\autoconfig.js instead of defaults\pref\local-settings.js (see bug 779437#c4)
    • news about Firefox 17 (second ESR)
  • 12-July-2012
    • text changes in foreword
  • 22-Feb-2012
    • Firefox 10.0.x-esr
  • 20-Feb-2012
    • Tiny update mentioning version 3.6.27, and progress towards update for version 10esr.
  • 23-Jan-2012
    • removed registry entries that caused duplicate entry in appwiz.cpl
    • added some comments about upcoming Firefox 10
  • 09-Jan-2012
    • added note about planned ESR version
  • 23-Dec-2011
    • updated registry file: some keys were missing, and now setting as default browser for all users
  • 21-Dec-2011
    • added note about replacing absolute paths in registry file
    • removed banner 'under construction'
  • 03-Dec-2011
    • added homepage_override.mstone to mozilla.cfg (don't tell users that their browser is outdated)
  • ??-Nov-2011
    • added mozilla.cfg, local-settings.js, and override.ini
  • ??-???-2011
    • replaced custom action (unreliable) with import of registry-file