Create an add-in for Outlook 2007 and 2010 in one solution No ratings yet.

Outlook add-ins seem popular again at the moment (we seem to go through phases as to the kind of cases that come in), and one question that has come up a few times now is how to create an add-in that targets both Outlook 2007 and 2010.  Fortunately, so long as you are using Visual Studio 2010, this is quite straight-forward.  Below is a step-by-step guide for creating such an add-in from scratch.  The development machine in this case was Windows 7 with Visual Studio 2010 and Outlook 2007 installed.  The guide is also attached to this post as a Word document.

 

New Project Development environment is Visual Studio 2010, running on Windows 7 with Outlook 2007 installed.
Create a new Outlook 2007 Add-in project.
Code For demonstration purposes, add a messagebox to the ThisAddIn_Startup method of class ThisAddIn.
The add-in will simply display a pop-up to confirm it is loaded when Outlook starts (this will show that the deployment has been successful).
Configuration Change the project configuration to Release, and then build the add-in (this is required to create the files needed for the installer package)
Add New Project Add a new project to the solution, and select Setup Wizard
Choose a project type Select Create a setup for a Windows application, then click Next
Choose project outputs to include Select Primary output from DemoOutlookAddIn, then click Next
Choose files to include

Add DemoOutlookAddIn.dll.manifest and DemoOutlookAddIn.vsto to the package (these files should be found in the \bin\release folder of the DemoOutlookAddIn project folder).

Click Finish.

Project Property Pages

Right-click the setup package (from Solution Explorer) and select Properties…

Click Prerequisites…

Prerequisites

Ensure that the required pre-requisites are selected.  These are:
Microsoft .NET Framework 4 Client Profile (x86 and x64)
Microsoft Office 2007 Primary Interop Assemblies
Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)
Windows Installer 3.1

Click OK, then OK again to get back to the main Visual Studio IDE.

Detected Dependencies Expand Detected Dependencies (in Solution Explorer), and exclude all dependencies except Microsoft.Office.Tools.Common.v4.0.Utilities.dll and Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll
Project properties Select DemoOutlookAddInSetup in Solution Explorer, then ensure InstallAllUsers property is True.  You can also adjust other properties as needed (such as author and manufacturer).  Note that the Manufacturer property determines the folder into which the add-in will be installed under Program Files.
Registry - add-in Right-click DemoOutlookAddInSetup in Solution Explorer, and select View then Registry.
Add the registry settings as shown to register the add-in into Outlook.
EnableLocalMachineVSTO Add the EnableLocalMachineVSTO registry setting.  Note that this is required for Outlook 2007 to enable add-ins to be installed to HKLM.  Also required is hotfix 976477 (http://support.microsoft.com/kb/976477) as detailed in KB 976811 (http://support.microsoft.com/kb/976811).
The hotfix must be installed for this deployment package to work with Office 2007.
Registry - redundant Delete any redundant registry keys (there are a couple created automatically under HKEY_CURRENT_USER).

 

That’s it!  You can now build the setup package and deploy to multiple clients.

 

Creating an add-in.docx

Please rate this

0

Leave a Reply

Your email address will not be published. Required fields are marked *