Add-in Express 2010 MSI-based web deployment – ClickTwice :)
Add-in Express provides two basic strategies for deploying its projects: publishing an application via the ClickOnce technology, or deploying it with a traditional setup using the Windows Installer. In case of ClickOnce deployment, your application is published to some centralized location, e.g. a network share, and the user installs it from that location. With Windows Installer deployment, you package the application in an .msi file and distribute that file together with setup.exe, which is used to install the application under the admin account. Under a non-admin user, it is sufficient to run the .msi file directly.
How to choose the right deployment technique
Several factors should be kept in mind when choosing a deployment strategy: user permissions (administrator or standard user), the frequency and means of application updates, and installation requirements.
Let’s consider the pros and cons of each strategy. In general, ClickOnce deployment works fine both for the end-user and the developer. The former gets quick and easy installation and updating while the latter makes less effort to tweak the installation. Add-in Express provides some methods for developers to make their ClickOnce applications self-updated. Though, this part of functionality should be implemented by the developer and depends on the application requirements. As for Windows Installer deployment, it offers greater flexibility and richer UI, a larger set of custom actions and powerful API.
Now a few words about distribution. With Windows Installer, you add a Setup project to your solution to create a setup file that is distributed to users. The user runs the setup file and goes through the steps of the installation wizard. With ClickOnce, you use the Publish wizard to package your application and publish it to a web-site or network file share; the user installs the application directly from that location in a single step. You may consider ClickOnce to be a more powerful technology as it provides automatic updates via the Internet. But what if to combine both technologies and try to use all the power of Windows Installer and the self-updating feature of ClickOnce! We have endeavored to do this and added a new type of deployment to Add-in Express – MSI-based Web deployment, also known as ClickTwice in privy circles :)
For the summary of all available deployment techniques – ClickOnce, Windows Installer and Add-in Express MSI-based Web deployment technologies, see the comparison table below.
ClickOnce, Windows Installer and Add-in Express MSI-based Web deployment
|Feature||ClickOnce||Windows Installer||Add-in Express
MSI-based Web deployment
|Update from Web||Yes||No||Yes|
|Affects shared components or other applications||No||Yes||Yes|
|Security permissions granted||Grants only permissions necessary for the application (deploying COM add-ins, it always requires Full Trust).||Grants Full Trust by default.||Grants Full Trust by default.|
|Security permissions required||Internet or Intranet Zone (Full Trust for CD-ROM installation)||Standard user or Administrator||Standard user or Administrator|
|Installation-time user interface||Single prompt||Multipart Wizard||Multipart Wizard|
|Installation of shared files||No||Yes||Yes|
|Installation of drivers||No||Yes (with custom actions)||Yes (with custom actions)|
|Installation to Global Assembly Cache||No||Yes||Yes|
|Installation for multiple users||No||Yes||Yes|
|Add application to Start menu||Yes||Yes||Yes|
|Add application to Startup group||No||Yes||Yes|
|Add application to Favorites menu||No||Yes||Yes|
|Register file types||No||Yes||Yes|
|Install time registry access2||Limited||Yes||Yes|
|Binary file patching||No||Yes||Yes|
|Application installation location||ClickOnce application cache||Changed by the user during the installation||Changed by the user during the installation|
- With ClickOnce, rollback is available in Add/Remove Programs.
- ClickOnce deployment can access HKEY_LOCAL_MACHINE (HKLM) only with Full Trust permissions.
As you see in the table above, there is just one difference between standard deployment via Windows Installer and our ClickTwice technology. It is the capability to automatically update applications developed for Microsoft Office and Internet Explorer with Add-in Express.
Creating a new setup project
Right click on the project item in the Solution explorer and choose 'Create Setup Project'. In the 'New Setup Project Wizard' dialog, fill in the 'Title', 'Project name', 'Description' and 'Company' fields (optional).
Click the Next button. Now you can enter localization and location of your setup.
Click Finish. A new setup project will be created. If it already exists in the output directory, you will be prompted to overwrite it. When the setup is ready, you will see something similar to the screenshot below.
When you open the File System editor of the setup project, you will see the following entries added by the wizard:
Also you can see some custom actions added to the Custom Actions editor. They run the adxregistrator.exe executable to register / unregister the application on the end-user’s PC.
Now you can build the setup. The following warning may appear while the setup project is being built.
WARNING: File ‘adxloader64.dll’ targeting ‘x64’ is not compatible with the project’s target platform ‘x86’
Don't care about the warning. It appears because Add-in Express provides the common setup project for both x86 and x64 platforms. Depending on the user’s permissions, Add-in Express wizard modifies the PostBuildEvent property of the setup project. The following command line can be used:
if the setup is configured to be installed under a standard user:
“<Add-in Express installation path>\adxpatch.exe” “$(BuiltOuputPath)” /UAC=Off
if the setup is configured to be installed under the administrator:
“<Add-in Express installation path>\adxpatch.exe” “$(BuiltOuputPath)” /UAC=On
The '/UAC' parameter determines if the UAC popup will appear in Vista or Windows 7 before the installation.
That’s all for now. In the next part of this series we will have a close look at publishing the application.