Create custom Windows Installer (MSI)
setup projects for Office add-in in Visual Studio
Add-in Express™ Add-in Express Home > Add-in Express for Office and .NET > Online Guide > Deploying Office add-ins > Windows Installer setup projects (.msi) Windows Installer setup projectsAdd-in Express enables developers to build Windows Installer based setup projects for their Office extensions in two ways:
Installation Software Products Supported by Add-in ExpressSupported are:
Add-in Express doesn’t directly support installation software products that don't integrate with the Visual Studio IDE. To deploy an add-in using such an installation software product, you need to "translate" instructions we publish in Creating a Visual Studio Installer setup project manually to the "language" of the product. A "translated" instruction is available for Advanced Installer; see here. Creating a setup project using Setup Project WizardTo help you create an installer for your Office plug-in, Add-in Express provides the setup project wizard accessible via menu Project | Create Setup Project in Visual Studio. Another way to run the wizard is shown in the screenshot. Let's run the setup project wizard for the sample project described in Writing Microsoft Outlook COM add-in. The below describes creating a standard setup project in Visual Studio. You may also want to check Creating a WiX setup project. The setup project wizard provides an extra step when creating a WiX based setup project; see Multiple-Language Setup Projects and Dual-Purpose Setup Projects. Specify the file name, localization and output directory for your setup project. The wizard creates and adds the following setup project to your Office add-in solution: The wizard creates the following entries in the Application Folder of your setup project (see menu View | Editor | File System): Also, the following custom actions are created for your setup project. They will be performed on the end-user's machine to register your add-in after installation and unregister it before uninstallation: Creating a Visual Studio Installer setup project for an Office add-in manuallyYou can create a Visual Studio Installer setup project manually; follow the steps below. To manually create a setup project for any other installation software product, you need to "translate" the steps below to the "language" of the product that you use. Note that you can check all the below-mentioned settings if you create a setup project using the setup project wizard. Add a new setup projectRight-click the solution item and choose Add | New Project. In the Add New Project dialog box, select the Setup Project item and click OK. This adds a new setup project to your solution. File system editorRight-click the setup project item and choose View | File System in the context menu. Application folder \ Default locationSelect the Application Folder item and specify its DefaultLocation property as follows:
Primary outputRight-click the Application Folder item and choose Add | Project Output to add the add-in's assembly to your setup project. In the Add Project Output Group dialog box, select the Primary Output item of your Add-in/RTD Server/Smart Tag project and click OK. For the sample add-in described in How to develop Microsoft Office COM add-in, this adds the following entries to the Application Folder of the setup project: Select AddinExpress.MSO.2005.tlb and, in the Properties window, set the Exclude property to True. If you use version-neutral interops, exclude the VB6EXT.OLB file in the same way. Always exclude all .TLB and .OLB files from the setup project except for .TLBs that you create yourself. Project-depended resourcesNow you add all resources (e.g. assemblies, dlls or any resources) required for your project. Add-in Express Loader and manifestAdd the adxloader.dll and adxloader.dll.manifest files from the 'Loader' subfolder of the add-in project directory to the 'Application Folder' of the setup project. Note. For an XLL add-in, the loader names include the assembly name, say, adxloader.MyXLLAddin1.dll. Add-in Express registratorAdd {Add-in Express}\Redistributables\adxregistrator.exe to the Application Folder. Custom actions editorRight-click the setup project item and choose View | Custom Actions in the context menu. Add custom actionsAdd new custom actions to the Install, Rollback, Uninstall sections of your setup project. Use adxregistrator.exe as an item for the custom actions. Custom actions argumentsAdd the strings below to the Arguments properties of the following custom actions:
If a COM add-in or RTD server is installed on the per-user basis, or if you deploy a smart tag or an Excel UDF, the value of the privileges argument above is user. If a COM add-in or RTD server is installed on the per-machine basis, in other words, if the RegisterForAllUsers property of the corresponding module is true, the value of the privileges argument above is admin. Say, for an add-in described in Developing Microsoft Office COM add-ins, the Arguments property for the Install custom action contains the following string: /install="MyAddin1.dll" /privileges=user DependenciesRight-click the Detected Dependencies section of the setup project and choose Refresh Dependencies in the context menu. Also, exclude all dependencies that are not required for your setup project. Launch conditionsRight-click the setup project item and choose View | Launch Conditions on the context menu. Make sure that the .NET Framework launch condition specifies a correct .NET Framework version and correct download URL. Note that we recommend using launch conditions rather than prerequisites because installing a prerequisite usually requires administrative permissions and in this way installing a per-user Office extension may result in installing the extension for the administrator, but not for the user who ran the installer. PrerequisitesRight-click the setup project and open the Properties dialog. If administrative permissions are required to install prerequisites, then for a per-user Office extension, the elevation dialog will be shown on UAC-enabled systems. If the administrator's credentials are entered in this situation, then the installer will be run on behalf of the administrator and therefore, the Office extension will be installed for the administrator, not for the user who originally ran the installer. Click the Prerequisites button and, in the Prerequisites dialog box, select required prerequisites. Final touchRebuild the setup project. Specify the following command line in the PostBuildEvent property of the setup project:
The executable – adxPatch.exe – also provides the /RunActionsAsInvoker parameter. If set to true (default), it specifies that adxRegistrator.exe used as a custom action will be run with the privileges of the user who launches the installer. Now build the setup project, copy all setup files to the target PC and run the .msi file to install the add-in. However, to install prerequisites, you will need to run setup.exe. |