MSI-based web deployment and updating
for Internet Explorer browser extensions

Add-in Express™
for Internet Explorer® and Microsoft® .net

Add-in Express Home > Add-in Express for Internet Explorer > Online Guide > MSI-based web deployment - ClickTwice :)

MSI-based web deployment - ClickTwice :)

Add-in Express provides its own MSI-based Web deployment technology, aka ClickTwice :) . Unlike ClickOnce, it allows both standard users and admins to run MSIs from the web (Internet and Intranet) for installing and updating per-user and per-machine IE extensions.

You use ClickTwice :) to deploy an IE extension over the web. This technology allows using your favorite installation software to create an .MSI installer. In case you develop your setup project in Visual Studio, see Creating MSI installers. When you have got the .MSI installer, open the Publish dialog of your Internet Explorer extension project.

Build the plug-in project and choose Publish ADX Project in the context menu or in the Project menu.

Publishing your IE add-on project

This opens the dialog window shown in the screenshot below.

Publishing dialog

Installer file

Specifying the path to the .MSI installer in the Publish dialog fills in some fields in the upper part of the dialog.

Publishing dialog - installer file and publishing location

Publishing location

You may publish the installer to a file share or FTP server; publishing to an IIS is not supported. When publishing the installer, the Publishing location can be a file path or a path to an FTP server. By default, the Publish wizard suggests publishing your application to the MSIPublish subfolder in the project directory. In Publishing location, enter the location using one of the following formats:

  • To publish to a file share, enter the path using either a UNC path such as \\Server\ApplicationName or a file path, say C:\Deploy\ApplicationName.
  • To publish to an FTP server, enter the path using the format ftp://ftp.domain.com/ApplicationName.

Installation URL

The location from which users download and run the installer may differ from the location where you initially published it. For example, in some organizations, a developer might publish an application to a staging server, and then an administrator can move the application to a web server. In this case, you can use the Installation URL field to specify the Web server to which users will go to download the installer. This step is necessary for Add-in Express to know where to check for updates. In Installation URL, enter the installation location using a fully qualified URL in the format http://www.domain.com/ApplicationName, or a UNC path using the format \\Server\ApplicationName.

Note. If Publishing location and Installation URL are the same, Installation URL will be empty when you open the Publish wizard next time.

Icon file

You can specify an icon in the Icon file field. The icon will be shown in the downloader window, which is displayed when the installer is downloaded from the installation location.

Certificate

To sign the installation files, browse for the existing certificate file or click New to create a new one. Enter the password for the certificate (optional).

Preferences

Click the Preferences button to open the Preferences dialog.

Setting the preferences of your IE add-ons

The dialog allows you to specify if the Windows installer UI will be shown during installation / uninstallation. Also, it allows specifying an arbitrary string such as the URL of a web page. That string will be returned by the CheckForUpdates method, see Updating an IE Extension via ClickTwice :). This allows implementing custom update logics, welcome pages, information pages, etc.

Prerequisites

Open the Prerequisites dialog and select the prerequisites required by your Internet Explorer extension.

IE add-on prerequisites

You must choose the following prerequisites for installing on a clean PC:

  • .NET Framework version you used when developing your IE extension;
  • Windows Installer 3.1 or 4.5.

Clicking Publish

Everything is ready; let's click the Publish button.

Publishing your IE add-on

This generates files discussed below.

Files generated by ClickTwice :)

In the process of publishing controlled by the Publish wizard, you specify the .MSI installer to be published as well as the location where subsequent updates of your IE extension will be located. The wizard generates the folder structure demonstrated in the screenshot below:

Publish folder

Below, we describe every folder shown in the screenshot.

Publish folder

The root folder of the folder structure created by the Publish wizard is the Publish folder; you can specify any other folder, of course. version-info.xml describes all updates available for the given product. A sample version-info.xml is shown below:

			
			<?xml version="1.0" encoding="utf-8"?>
			<application name="myieaddon">
			  <product language="1033">
				<version name="1.0.0" installationUrl="http://www.MySite.com/Updates/" 
				productCode="{D9AC86C7-FBA0-48B9-942C-E51DB169AFCE}" updateType="bootstrapper">
				  <files msi="MyIEAddonSetup(1.0.0)">
					<file>MyIEAddonSetup(1.0.0).msi</file>
				  </files>
				  <preferences>
					<showInstallUI>true</showInstallUI>
					<showUninstallUI>false</showUninstallUI>
					<webPage>
					</webPage>
					<showDownloaderWindow>true</showDownloaderWindow>
				  </preferences>
				</version>
				<version name="1.0.1" installationUrl="http://www.MySite.com/Updates/" 
				productCode="{D9AC86C7-FBA0-48B9-942C-E51DB169AFCE}" updateType="bootstrapper">
				  <files msi="MyIEAddonSetup(1.0.1)">
					<file>MyIEAddonSetup(1.0.1).msi</file>
				  </files>
				  <preferences>
					<showInstallUI>true</showInstallUI>
					<showUninstallUI>false</showUninstallUI>
					<webPage>
					</webPage>
					<showDownloaderWindow>true</showDownloaderWindow>
				  </preferences>
				</version>
			  </product>
			</application>			
			

Language-specific folders (1033 etc.)

Folder 1033 in the screenshot below is named according to the language code of the installer UI. A list of language codes (or Locale Ids) can be found here.

Version-specific folders (1.0.0 & 1.0.1)

These folders are named according to the version of your .MSI installer; see the Version property of the setup project in VS. You see the content of such a folder in the screenshot below:

Version-specific folder

The folder includes the following files:

  • The .MSI installer you specified.
  • setup.exe; it is an unmanaged executable, which is generated only if prerequisites are specified. It downloads and installs the prerequisites from {Installation URL}/{Language code}/{Version}/prerequisites. When pre-requisites are installed, the setup.exe runs the downloader (see below).
  • An executable called downloader; it downloads the .MSI file from {Installation URL}/{Language code}/{Version} and runs it. It is launched either by setup.exe (after installing prerequisites) or by the user (if no prerequisites are used). The file name of the downloader is set to the name of your project, such as myaddin1.exe.

Updating an IE Extension via ClickTwice :)

Every Add-in Express module provides the CheckForUpdates method. When your IE extension calls it, the version_info.xml is downloaded via HTTP and parsed. If there are no updates, CheckForUpdates returns an empty string. If there are new updates, CheckForUpdates finds the latest update and returns either the URL of the corresponding setup.exe (if it exists) or the downloader.

Note.To implement custom update logics, welcome pages, information pages, etc., you may choose CheckForUpdates to return an arbitrary string; see Preferences.

The code sample below demonstrates installing a new version of your IE extension programmatically.


			private void Update()
			{
			   if (this.IsNetworkDeployed() && this.IsUpdatable())
			   {
				  string updateUrl = this.CheckForUpdates(); 
				  if (!String.IsNullOrEmpty(updateUrl)) 
				  {
					 if (MessageBox.Show("A new version of the add-in was detected. " + 
						"Would you like to install the update?",   
						this.ModuleName, MessageBoxButtons.YesNo,   
						MessageBoxIcon.Question) == DialogResult.Yes)   
					 {
						string ieFullPath =   
						   Path.Combine(Environment.GetFolderPath(   
						   Environment.SpecialFolder.ProgramFiles),   
						   "Internet Explorer\\iexplore.exe");   
						   this.CreateProcess("\"" + ieFullPath + "\" \"" + updateUrl + "\"");
					 }
				  }
			   } 
			}  
			

The code is based on three methods.

  • IsNetworkDeployed - returns True if the application was installed via ClickTwice :).
  • IsUpdatable - returns True if the user is permitted to update the application. In Vista or Windows 7, it is always True. If the application was installed for all users and the current user is not an administrator, the UAC popup will ask for administrator credentials.
  • CheckForMSIUpdates - returns an empty string if there are no updates in the location specified in the Installation URL field of the Publish dialog.
  • If a new version of the add-in is available, CheckForMSIUpdates returns one of the following strings: a URL or UNC path (the URL can be a link to setup.exe or the application downloader), or the value specified in the Download page for updates in the Preferences dialog (see Preferences).

In the code above, we use CreateProcess to launch the executable specified in the update URL. The code runs Internet Explorer in the same integrity level as the host application. Of course, you can use your code to initiate updates on the target machine. E.g. you can use the Process class to launch the default browser providing it with the URL returned by CheckForMSIUpdate.

Note. In the sample code above, we specified the full path to iexplore.exe (which is the Internet Explorer application) in the CreateProcess method. However, this approach does not work for Internet Explorer 6. In this case, you can specify the full path to explorer.exe (which is the Windows Explorer application). Many thanks to Aaron for the suggested workaround!

IE add-on deployment - Creating MSI installers <<