Deploying per-user Office extensions via Group Policy
This is part 6 of the deployment series that targets corporate deployment techniques and provides step-by-step instructions for deploying your per-machine Office extensions via Group Policy. I recommend that you start with reading Part 1 that gives a brief overview of all deployment technologies.
Step 1. Set RegisterForAllUsers = false
If you develop a COM add-in, an RTD server or smart tag, set the RegisterForAllUsers property of your add-in module, RTD server module or smart tag module to False. If you develop an Excel add-in (XLL add-in or Automation add-in), go to Step 2 below.
Before you modify the RegisterForAllUsers property, you must unregister the add-in project on your development PC and make sure that adxloader.dll.manifest is writable.
To access the RegisterForAllUsers property in the Properties window, click the designer surface of the module:
Step 2. Build your project
To support 32-bit and 64-bit Office, set the Platform target property to “Any CPU” before building your project.
If you use a 32bit component in your Office extension (say a native-code DLL, ActiveX DLL , or .NET assembly), you have to compile it for the x86 platform. Please keep in mind that such an Office extension will work in 32bit Office 2000-2016 only and will not work in 64bit Office 2010-2016. Similarly, if you use a 64bit component, you have to compile the project for the x64 platform but your Office extension will work in 64bit Office 2010-2016 only.
Summing up, if you use a bitness-aware component, your extension will work for Office versions of that bitness only.
Step 3. Create a setup project
Add-in Express provides the setup project wizard accessible via Project | Create Setup Project menu in Visual Studio as well as via the context menu of the project item in the Solution Explorer window (shown below).
In the New Setup Project Wizard dialog box, fill all the fields (Title, Description, Product name, Company of your Office extension) and click the Next button.
On the next step, you can choose the localization of the installer UI, output directory and file name.
Click the Finish button. This creates a new setup project.
Step 4. Check the DefaultLocation property
Select your setup project in the Solution Explorer window and open the File System editor using menu View | Editor | File System. Select the Application Folder node and check the DefaultLocation property. By default, the setup wizard sets the DefaultLocation property to the user’s application data folder as follows:
[AppDataFolder][Manufacturer]\[ProductName]
Step 5. Delete custom actions
Select your setup project in the Solution Explorer window and open the Custom Actions Editor. If you used the Add-in Express wizard, then in the setup project that was created by the wizard there are 3 custom actions in which adxregistrator.exe is used. Delete these custom actions.
Step 6. Add new custom actions
In the Custom Actions Editor, add three new custom actions under Install, Rollback and Uninstall by selecting adxloader.dll as a custom action. Then change the EntryPoint property for each of the actions as show below:
Install: EntryPoint = “DllRegister”
Rollback: EntryPoint = “DllUnregister”
Uninstall: EntryPoint = “DllUnregister”
Step 7. Set PostBuildEvent
Select your setup project in the Solution Explorer window and edit the PostBuildEvent property as follows:
“{Add-in Express}\Bin\adxpatch.exe” “$(BuiltOuputPath)” /UAC=Off /RunActionsAsInvoker=true
Where:
{Add-in Express} is the full path to the installation folder of Add-in Express.
This executable patches the generated .MSI in the following ways:
- it hides the “For Me” and “For Everyone” choice in the installer UI.
- it turns off the dialog asking for administrative privileges; the UAC dialog pops up when a non-admin user runs the .MSI installer that the setup project generates. Switching off the dialog is necessary because a per-user Office extension cannot require administrative permissions.
The option /RunActionsAsInvoker=true specifies that the installer will be run with the privileges of the user who started the installer and not with the system privileges.
Step 8. Build the setup project
Build your setup project and deliver the generated .msi file to the administrator.
Step 9. Running the installer using Group Policy
Use Group Policy to deploy and automatically install / uninstall your product. You can read how to do it in this article: HowTo: Install a COM add-in automatically using Windows Server Group Policy.
Step 10. Installing a new version of the Office extension
You need to change the assembly version of your Office extension as well as the version of the setup project and rebuild your setup project. The admin needs to remove the installation package and assign a new one as described in HowTo: Install a COM add-in automatically using Windows Server Group Policy.
Don’t change the Product code property of your setup project. By default, when you change the Version property of your setup project, Visual Studio shows a dialog recommending that you change the Product code. Click No or Cancel in this dialog because if you change the Product code, you will get a new Office extension installer, consequently the previous version of your extension may not uninstall correctly when the user launches the new version installation.
4 Comments
Thanks for this article.
Can I delete the file adxregistrator.exe from my setup?
Hi Bas,
The adxregistrator.exe tool is purposed for registration and un-registration of your add-in on the target machine. So, you needn’t delete this file.
Do you have instructions for achieving the same thing with a Wix setup please?
Hi Nick,
Sorry, we do not have instruction for a WiX setup but I think you can create a default WiX setup project, build it and test its deployment via the Group Policy. I am almost sure the adxRegistrator.exe will work correctly.