Deploy Office 2010-2000 add-in / plugin
Use shims and loader in C#, VB.NET, C++

Add-in Express™
for Microsoft® Office and .net

Add-in Express Home > Add-in Express for Office and .NET > Online Guide > Deploying Office solutions > ClickTwice :) deployment

MSI web-based deployment - ClickTwice :)

You use ClickTwice :) to deploy a per-machine Office extension over the web. This technology allows using your favorite installer to create an .MSI installer. For instance, you can develop your setup project in Visual Studio, see Creating MSI installers. If you have the .MSI, you open the Publish dialog.

On this page you will find information pertaining to:

Publishing with ClickTwice :)

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

Publish ADX Project

This opens the dialog window shown in the screenshot below.

Publish 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.

Fields in the upper part of the Publish dialog are filled

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.

Preferences dialog

The dialog allows you to specify if the Windows installer UI will be shown during installation / uninstallation. Also, it allows specifying a URL of a web page to be returned by the CheckForUpdates method, see Updating an Office 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 Office extension.

Prerequisites dialog

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

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

Clicking Publish

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

Publish installer is ready

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 Office extension will be located. The wizard generates the folder structure demonstrated in the screenshot below:

Files generated by ClickTwice

Below, we describe every folder shown in the screenshot.

Folder MSIPublish

The root folder of the folder structure created by the Publish wizard is the MSIPublish 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="myaddin1">
			  <product language="1033">
				<version name="1.0.0" installationUrl="http://www.MySite.com/Updates/" 
					productCode="{4A23B0EC-70BA-431D-BB27-C1D8F820F534}" 
					updateType="bootstrapper">
				  <files msi="MyAddin1Setup(1.0.0)">
					<file>MyAddin1Setup(1.0.0).msi</file>
				  </files>
				  <preferences>
					<showInstallUI>true</showInstallUI>
					<showUninstallUI>false</showUninstallUI>
					<webPage>
					</webPage>
				  </preferences>
				</version>
				<version name="1.0.1" installationUrl="http://www.MySite.com/Updates/" 
					productCode="{9465C230-1A48-4D52-AC34-99EFFEBEB2C4}" 
					updateType="bootstrapper">
				  <files msi="MyAddin1Setup(1.0.1)">
					<file>MyAddin1Setup(1.0.1).msi</file>
				  </files>
				  <preferences>
					<showInstallUI>true</showInstallUI>
					<showUninstallUI>false</showUninstallUI>
					<webPage>
					</webPage>
				  </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 folders

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 Office extension via ClickTwice :)

Every Add-in Express module provides the CheckForUpdates method. When your Office 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 a URL of your choice; see Preferences.

The code sample below demonstrates installing a new version of your COM add-in programmatically; the user clicks a Ribbon button to initiate the process.


			private void adxRibbonButton1_OnClick(object sender, 
			   AddinExpress.MSO.IRibbonControl control, bool pressed)
			{
			   if (this.IsMSINetworkDeployed() && this.IsMSIUpdatable())
			   {
				  string updateUrl = this.CheckForMSIUpdates(); 
				  if (!String.IsNullOrEmpty(updateUrl)) 
				  {
					 if (MessageBox.Show("A new version of the add-in was detected. " + 
						"Would you like to install the update?",   
						this.AddinName, 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.

  • IsMSINetworkDeployed - returns True if the application was installed via ClickTwice :).
  • IsMSIUpdatable - 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.

Step-by-step samples

Please check the following articles:

Add-in Express ClickOnce solution <<

>> Tips and notes

Back to Add-in Express for Office and .NET homepage