Building and deploying an Outlook 2010 Add-in (part 2 of 2)


In the first part of this series, we went through the steps to create a simple Outlook 2010 add-in, how to build a custom ribbon, and finally the backstage area. But what use is your add-in unless other people can use it too? In part 2, we will look at the steps to create a setup package so that you can distribute your add-in to others.

Setup Project

Returning to the solution you started in part 1, you will now need to add a Setup Project. I’ll call mine “SetupMyOutlookAddIn”. When the project has loaded in, Visual Studio will bring up the File System screen of your Setup Project. We will need to make a few changes here:

  • Select Application Folder, and open the Properties window (you will probably find it easier to have the properties window open the whole time – we will be using it a lot!)
  • In the Properties window, under DefaultLocation, change [ProgramFilesFolder][Manufacturer]\[ProductName] to [AppDataFolder][Manufacturer]\[ProductName]
  • Now, right click Application Folder – Add – Project Output… and on the dialog that appears, choose “Primary Output”.

We’ve now effectively told the setup project to install all our application goodness to the user’s AppData folder (Normally C:\Users\[username]\AppData in Windows 7, for example). We are doing this as this is a safe, sandboxed location that requires a minimum of privileges to install to. Here’s roughly how your screen should look now…

FileSystem_25D70833

Now, we need to remove some of the .dll files that were added as Primary Output (because we do not need them). In Solution Explorer:

  • Expand ‘Detected Dependencies’ in your Setup Project.
  • Right click and ‘Exclude’ everything under this folder except for:
    • Microsoft.NET Framework
    • Microsoft.Office.Tools.Common.v4.0.Utilities.dll
    • Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll

There are now 2 files you need to reference explicitly in your setup project. These are files that are created when you build your solution – so you will need to point to the release folder. You may use debug if you wish – just remember you are pointing there. For production software, you should point to release. So, in the File System window of your setup project:

  • Right-click the Application folder and select Add – File…
  • Browse to your application folder, and then bin\Release
  • Select the .dll.manifest, and .vsto files that reside there.

Your File System window should now look something like this:

FileSystem2_17988F43

Registry

To get our add-in working, we will need to add registry keys. When you are developing the solution in Visual Studio, this happens automatically in the background, so it can be a surprise that you will need to do it explicitly! The keys we are creating will be saved to: HKCU\Software\Microsoft\Office\Outlook\Addins.

Open the Registry Panel in your Setup Project, then:

  • Expand the HKEY_CURRENT_USER key, then Software, and rename [Manufacturer] to Microsoft (because we are adding this key to the Microsoft Office section of the Registry).
  • Create a tree of key values underneath Microsoft: Office\Outlook\Addins
  • Finally, create a key for your add-in. Give it a unique name, such that it is different from the add-in project name (so you can identify keys created by the installer, and keys created by Visual Studio).
  • In that key, set the following values:
    • String – “Description”
    • String – “FriendlyName”
    • String – “Manifest” – set this to “[TARGETDIR]MyOutlookAddIn.vsto|vstolocal”
    • DWORD – “LoadBehavior” – set this to “3”
  • Select your new key (the one you just set values for) and in the Properties window, set DeleteAtUninstall to be true (important: do not set it for any keys higher up in the tree!)

Here’s how your Registry screen should now look:

Registry_17988F43

Prerequisites

Now, we need to make sure that the Setup.exe you produce will check for prerequisites on the client system. This can be done by:

  • Right-click your add-in project (not your setup project) and select properties
  • Ensure the following are ticked:
    • Microsoft .NET Framework 4 Client Profile (x86 and x64)
    • Microsoft Visual Studio 2010 Tools for Office Runtine (x86 and x64)

Prerequisites_17988F43 

Finishing Touches

We’re pretty much done! A few things you may want to change:

  • Open the properties panel of your setup project and update the values there such as Version and Product Name.
  • Open the User Interface editor of your setup project, and delete the Installation Folder screen. This will stop users from installing the add-in to a different location (that may stop your add-in from running).

Build your add-in, and then right-click your Setup Project and select Install. The next time you open Outlook, you should be prompted to allow your new add-in to run!

Written by Matthew Farmer

Comments (36)

  1. Dinesh says:

    I have my database name and password in ConnectionString.xml file and i access like My.Application.Info.DirectoryPath from my code.I followed the given steps and i show error like "file not found". How can i add the xml file to my addins

    mail id: dineshb.62@pearlsofttechnology.com

    thank you in advance

    dinesh

  2. Dinesh says:

    I have my database name and password in ConnectionString.xml file and i access like My.Application.Info.DirectoryPath from my code.I followed the given steps and i show error like "file not found". How can i add the xml file to my addins

    mail id: dineshb.62@pearlsofttechnology.com

    thank you in advance

    dinesh

  3. Mukunda says:

    I fallowed the same steps bu while opening the outlook I got this error Please suggest me on the same.

    Customization could not be loaded because the application domain could not be created.

    ************** Exception Text **************

    Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: Customization could not be loaded because the application domain could not be created. —> System.ObjectDisposedException: Cannot access a disposed object.

    Object name: 'SolutionInstallerDialog'.

    at System.Windows.Forms.Control.CreateHandle()

    at System.Windows.Forms.Form.CreateHandle()

    at System.Windows.Forms.Control.get_Handle()

    at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

    at System.Windows.Forms.Form.ShowDialog()

    at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstallerDialog.ShowDialog()

    at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.Install(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeDeploymentManager, AddInInformation& info)

    at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.ProcessInstallerOperation(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeAddInDeploymentManager, AddInInformation& info)

    at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.ProcessInstallerOperation(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeAddInDeploymentManager, Boolean showUIDuringDeployment)

    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String documentFullLocation, String documentName, String assemblyLocation, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, IntPtr& executor)

    — End of inner exception stack trace —

    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String documentFullLocation, String documentName, String assemblyLocation, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, IntPtr& executor)

    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.ICreateCustomizationDomain.CreateCustomizationDomain(String documentFullLocation, String documentName, String assemblyLocation, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, IntPtr& executor)

    ************** Loaded Assemblies **************

    mscorlib

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Office.Runtime.v9.0

    Assembly Version: 9.0.0.0

    Win32 Version: 9.0.21022.123

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll

    —————————————-

    System

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

    —————————————-

    System.Core

    Assembly Version: 3.5.0.0

    Win32 Version: 3.5.21022.8 built by: RTM

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll

    —————————————-

    System.AddIn

    Assembly Version: 3.5.0.0

    Win32 Version: 3.5.21022.8 built by: RTM

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.AddIn/3.5.0.0__b77a5c561934e089/System.AddIn.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0

    Assembly Version: 9.0.0.0

    Win32 Version: 9.0.21022.123

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.v9.0.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0

    Assembly Version: 9.0.0.0

    Win32 Version: 9.0.21022.123

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0

    Assembly Version: 9.0.0.0

    Win32 Version: 9.0.21022.123

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll

    —————————————-

    System.Windows.Forms

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

    —————————————-

    System.Drawing

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

    —————————————-

    System.Xml

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

    —————————————-

    System.Deployment

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)

    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Deployment/2.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll

    —————————————-

  4. Matthew Farmer says:

    Mukunda it looks like you are targeting VSTO 3. You may find more information about this problem here: social.msdn.microsoft.com/…/543a9f63-908e-4292-b30a-cff07e4b6709

  5. Matthew Farmer says:

    Dinesh: Have you set the "Copy to Output directory" value of the xml file, and ensured that it appears in the file system/application folder of the Setup Project (you can put it there manually if not)? The other thing you could do is put the connection information in the project settings, so these will be shipped in the app.config automatically for you.

    Matt

  6. Michael Tobisch says:

    Hi,

    thanks for this great step-by-step tutorial. I have followed it with interest, and written my first Outlook COM-AddIn.

    My only problem is: after running the MSI file on another machine (not the dev machine), I have to double-click the .VSTO file in the installation directory to get the AddIn in Outlook.

    Any ideas?

    Best wishes

    Michael

  7. Oleg Ilyushyn says:

    Michael, check registry settings. The "Manifest" value should be a path to your vsto file

  8. rickey says:

    i'm facing the same problem. tried out everything. running the setup won't make the add-in load in outlook. only running the vsto works! I have outlook 2010 64 bit on windows 7 64 bit and in my setup I've set the target platform as x64.

  9. Glen says:

    Hi

    Thanks for a great guide. I'm facing some problems on my client computers after my add-in has been installed. I have even tried to use a "hello world" add-in but the same thing happens. The add-in is listed in Inactive Application Add-ins.

    Do you have any suggestions on what could be wrong?

    When I try to enable it I get the following error:

    ————————————————————-

    Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

    ************** Exception Text **************

    System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

      at Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IHostServiceProvider.SetProperty(String name, Object value)

      at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.GetAssemblyDataFromManifests(String solutionLocation, String manifestLocator, String documentName, Boolean showUIDuringDeployment, CustomizationType customizationType, OfficeVersion officeVersion, IHostServiceProvider interopServiceProvider)

      at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String solutionLocation, String manifestName, String documentName, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, Boolean useFastPath, IntPtr& executor)

    ************** Loaded Assemblies **************

    mscorlib

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.225 (RTMGDR.030319-2200)

       CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Office.Runtime

       Assembly Version: 10.0.0.0

       Win32 Version: 10.0.31117.0

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.Hosting

       Assembly Version: 10.0.0.0

       Win32 Version: 10.0.31117.0

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.ServerDocument

       Assembly Version: 10.0.0.0

       Win32 Version: 10.0.31117.0

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll

    —————————————-

    Microsoft.Office.Tools

       Assembly Version: 10.0.0.0

       Win32 Version: 10.0.31117.0

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.dll

    —————————————-

    Microsoft.VisualStudio.Tools.Applications.Runtime

       Assembly Version: 10.0.0.0

       Win32 Version: 10.0.31117.0

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll

    —————————————-

    System

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

    —————————————-

    System.Core

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

    —————————————-

    System.Windows.Forms

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

    —————————————-

    System.Drawing

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

    —————————————-

    System.Xml

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

    —————————————-

    System.Deployment

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll

    —————————————-

    System.Configuration

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

    —————————————-

    System.Security

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll

    —————————————-

    System.Xml.Linq

       Assembly Version: 4.0.0.0

       Win32 Version: 4.0.30319.1 built by: RTMRel

       CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll

    —————————————-

  10. Glen says:

    My issue is solved. The problem was that I used the "click-to-run" office trial on the test client machine. I downloaded the full install version and now everything runs smooth.

  11. Dave says:

    First, thanks for the tutorial it was extremely helpful.  Second and this goes out to anyone who may know the answer.  basically I have created an additional form region and added it to the appointment/meeting class.  Everything works as expected however, if I send a meeting to users and then look in my personal sent items the additional form field is not there.  It does appear if I pull up the appointment in the calendar though.  I am thinking that it may be that the calendar appointment and the sent appointment are stemming from 2 different classes one being appointment and the other being mail but I was hoping to get some diffinitive insight into the matter.  If it is because they stem from 2 different classes can the new form data be passed to the sent item object?

    Any information anyone is willing to share would be greatly appreciated as I seem to be unable to find an answer via Google.

    Thanks,

    Dave

  12. Alfredo says:

    Hi All,

    I've a few questions,

    i want to make an add-in with this pourpouses.

    i make a reply to a mail, when i push the send button, make me a question,  if this mail is in a folder, and the answer is true, i reply this mail addin a new address to bcc and changing the subject.

    But i do not know how i can make this.

    Thanks

  13. Rahul says:

    can i use outlook 2010 addin in outlook 2007

  14. Raza says:

    Hi,

    am beginner , i do  follow you tutorial ,

    i have one problem , i want to show this tab in reading and explorer  only

    and hide in other actions(calender,task….)

    how to do that…?

  15. Hansjoerg says:

    Top Article, works absolutly fine for me, Thanks!

  16. Siddharth Vidhani says:

    I tried your example using Outlook 2010 Ultimate version on Outlook 2010 Professional but I don't see the add-in being loaded in outlook. Neither does it show in the Active Application Add-in or Inactive Application Add-ins. Can you tell me what could be wrong here.

  17. Hi,

    Excellent Articale !!!

    However, I want my setup project to be installable on both outlook 2007 and 2010 as well. I followed the article for outlook 2010 and It works fine, but does not install well for outlook 2007.

    Any Idea about how to make it work for both outlook 2007 and 2010.

    Thanks

  18. Nik says:

    i am unable to find the .dll.manifest, and .vsto files  from my application folder .i was clearly following your tutorial but now i got paused. please help me to finish it. what might have went wrong ???

  19. Hi, its nice article. Can any body suggest to suppress the security message having options "Install" and "Don't Install". Moreover when I install setup its name is shown in install/uninstall list. When I run outlook first time, it install addin if i press "install" option and my addin project name becomes also visible in install/uninstall list. Is it normal behaviour. Futher when i uninstall the addin setup, setup name is removed from install/uninstall list but my addin project name remains there and i have to remove it manually by right click and uninstall option.

  20. CJMAX says:

    I wanted to call Connection string here.How can i do it ?

  21. Live99 says:

    How do i add GridView to XML Document ? I tried to add another button like below but failed.

    <primaryItem>

         <button id="buttonBackStage" label="Sort" onAction="buttonBackStage_Click"/>     <<< Working

         <button id="buttonBackStage2" label="Sort2" onAction="buttonBackStage2_Click"/>   <<< with this not working

             </primaryItem>

  22. Paulie says:

    Really good guide, much better than the official documentation.  Just used this to publish my own Outlook plugin.

    Thank you.

  23. Nilesh says:

    I am very new to VS 2010 and so how do I add a Setup Project. Do you mean, I create a completely new project. How to I get to File System screen of your Setup Project?

  24. Pradeep says:

    I have created an outlook Add-in and a Set up project with the same procedure as you explained.But after installing when i open the outlook i am getting the below error.But if i run the .vsto file directly addin will be installed successfully.But any how we cant install this .vsto file directly in another system as we require visual studio tools.

    Can you just tell me when i am getting the error after installing with the setup project

    Name:

    From: file:///C:/Users/Mutiara1/AppData/Roaming/Default Company Name/dface_OutlookAddin/MyOutlookAddIn.vsto

    ************** Exception Text **************

    System.Deployment.Application.DeploymentDownloadException: Downloading file:///C:/Users/Mutiara1/AppData/Roaming/Default Company Name/dface_OutlookAddin/MyOutlookAddIn.vsto did not succeed. —> System.Net.WebException: Could not find file 'C:UsersMutiara1AppDataRoamingDefault Company Namedface_OutlookAddinMyOutlookAddIn.vsto'. —> System.Net.WebException: Could not find file 'C:UsersMutiara1AppDataRoamingDefault Company Namedface_OutlookAddinMyOutlookAddIn.vsto'. —> System.IO.FileNotFoundException: Could not find file 'C:UsersMutiara1AppDataRoamingDefault Company Namedface_OutlookAddinMyOutlookAddIn.vsto'.

    File name: 'C:UsersMutiara1AppDataRoamingDefault Company Namedface_OutlookAddinMyOutlookAddIn.vsto'

      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

      at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

      at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)

      at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

      — End of inner exception stack trace —

      at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

      at System.Net.FileWebRequest.GetResponseCallback(Object state)

      — End of inner exception stack trace —

      at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)

      at System.Net.FileWebRequest.GetResponse()

      at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

      — End of inner exception stack trace —

      at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)

      at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

  25. Evahn says:

    Thanks very much for this tutorial.

    I was able to deploy an Outlook add-in successfully and have it automatically loaded by registry settings managed by GPO.  So all good on that side of things!

    However, I'm confused on how to deploy an update to the add-in.

    I can see that running the initial install of the MSI deploys the manifest and vsto files to the application directory (C:Program Filesblah), then our registry changes force the vsto to be installed for the current user when they next start Outlook.  All good.

    If I then update the add-in and associated setup project, including all of the version numbers, the new MSI can successfully deploy the new manifest and vsto files to the same application directory but the user's add-in will not automatically update to use the new files, instead it will continue to run the old version of the add-in.

    It appears that the vsto has to be first manually uninstalled by the user (they may see a duplicate of the add-in name in their Programs and Features control panel that they can uninstall even if they're not local admin).

    After that the registry settings will again force the updated manifest and vsto files to be installed.

    I just don't know why this bit isn't automatic when it sees the vsto and manifest files with higher version number in the application directory.

    I can probably run the automatic uninstall through a logon script but just wondering if I am missing something?

    Cheers

  26. Anson says:

    Dot Net 4.0 Client doesnt make addins can load. Must use dot Net 4.0 Full package.

  27. Gpg says:

    excellent article! very complete and useful. Thank's

    However some things are missing or problematic:

    1 ◦ String – "Manifest" – set this to "[TARGETDIR] MyOutlookAddIn.vsto | vstolocal"

    the corect value is: file :///[TARGETDIR]MyOutlookAddIn.vsto|vstolocal to avoid errors with vs2010

    2. The following key HKCUSoftwareMicrosoftOfficeOutlookAddinsMyOutlookAddIn works locally, not with Terminal Server or Citrix. For Terminal Server and Citrix, it is necessary to add the following key: HKLMSoftwareMicrosoftOfficeOutlookAddinsMyOutlookAddIn. In Terminal Server x64 with Office 2010 x86, this is enough.

    3 in a mixed environment (Windows x64 and Office x86) and Citrix, Outlook plugin does not appear without the following key: HKLMSoftwareWow6432NodeMicrosoftOfficeOutlookAddinsMyOutlookAddIn

    obviously, all the key value must be present (Description, FriendlyName, Manifest and LoadBehavior) for each registry key

  28. RadsM says:

    Thanks for this post ! Very helpful guide on building an AddIn. How can I release a change to the AddIn once it has been deployed already on a client ? Do I need to remove and install the setup again, or just copy some of the dll files?

  29. Partha says:

    I am new to Visual Studio. Can someone help me to create a setup project? How to create the setup project?

  30. Lama says:

    This will Help You "Partha " for creating a setup for your project ins visual studio

    http://www.c-sharpcorner.com/…/adding-a-setup-project-in-visual-studio-2010.aspx

  31. Saurabh says:

    I have created outlook add in in visual studio 2010 with outllokk 2010. it is working fine but when i try to deploy my setup for office 2007 it is not working(means ThisAddin_NewMail) event is not raising also i have created new solution with office 2007 but i am not getting success…any suggestion

  32. Ali says:

    Hi, Great article , will this Add-in work in Outlook 2013 as well ?

  33. Parva says:

    Great Article. This has helped us. Thank a ton for this post.

  34. Ridhika says:

    Thanks for this great article. I have created this setup for my Outlook Addin. Have set the LoadBehavior property to 3. But after a few days, the registry entry of LoadBehavior automatically got changed to 2 and the add in started appearing in my "disabled add ins" section stating that the add in is taking more action to load than usual. Please tell me how can this be fixed?

  35. Answer to Ridhika says:

    Hi Ridhika, you can change that value opening the registry and going to the folder (HK_USERS–>Software –> Microsoft –> etc..) and changing the value of the LoadBehavior by yourself.

    Another way would be making that the add-in loads, but that would be from Outlook's options.

  36. Answer to Ali says:

    Hi Ali

    Yes this add in works with outlook 2013.  I just tried