简体   繁体   中英

Outlook COM addin installed but not loading in Outlook

I have created an Outlook addin using Visual Studio 2010 that installs fine and creates the appropriate registry keys and folders in Program Files (x86) as I have specified and it shows in Add and Remove programs.

However, when I launch Outlook 2010 - it doesn't show up and when I check the COM Addins, it is not available in the list. I created the Setup in VS and added the Output of the main project in the file system as usual and also included the .vsto file.

Any pointers anyone please?

Since you are running x64 OS and x64 Office , you don't use Wow6432Node - it's only there for Registry Reflection for 32-bit apps on x64 OS . The proper registry hive for you to use is below....

All User Hive (x64 Office on x64 OS)

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook\Addins\[add-in ID]

See related SO post regarding proper VSTO registry paths .

You can run your add-in via HKLM for all users WITHOUT ClickOnce with this hard-to-find trick:

Put a pipe and a "vstolocal" flag after your VSTO manifest path value thus:

at HKLM\\Software\\Microsoft\\Office\\Outlook\\Addins\\MyVSTOAddIn
manifest="C:\\Program Files\\Publisher\\MyVSTOAddIn\\MyVSTOAddIn.vsto|vstolocal"

(See: http://blogs.msdn.com/b/vsto/archive/2010/03/08/deploying-your-vsto-add-ins-to-all-users-saurabh-bhatia.aspx )

and set the EnableLocalMachineVSTO flag like so:

at HKLM\\Software\\Microsoft\\Office\\14.0\\Common\\General
(DWORD) EnableLocalMachineVSTO=1

(See: http://social.msdn.microsoft.com/Forums/vstudio/en-US/e724cdcb-ccad-4d9f-826a-65a6816409f9/vsto-alluser-addin-fails-to-load-on-several-clients )

Also, if you are installing to a 64-bit version of Windows, you will have to enable local machine installation with two values in another location:

at HKLM64\\SOFTWARE\\Microsoft\\VSTO Runtime Setup\\v4
(DWORD) EnableVSTOLocalUNC=1
(DWORD) EnableLocalMachineVSTO=1

(See: http://support.microsoft.com/kb/2022442 )

No SideBySide, no PromptingLevel, no VSTO\\Security\\Inclusion, and no Active Setup\\Installed Components "StubPath" necessary! Just install and run.

Added 10/03/2013...

It also turns out that Outlook 2010 in Win64 has further difficulty trusting VSTO add-ins unless you sign them with a real Code Signing PFX and put the certificate in the Trusted Publishers store of the user's machine. I wrote this command line utility with the PFX embedded in the executable to make the certificate part of the installation process. To gain access to the local machine Trusted Publishers store, this must be run as administrator:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.IO;

namespace TrustCert
{
    class Program
    {
        static void Main(string[] args)
        {
            string msg = "";
            try
            {
                byte[] pfx;
                var assembly = typeof(Program).Assembly;
                string pfxName = "";
                foreach (string mr in assembly.GetManifestResourceNames())
                {
                    if (mr.Contains("MyPfxName"))
                    {
                        pfxName = mr;
                        break;
                    }
                }
                using (var stream = assembly.GetManifestResourceStream(pfxName))
                {
                    pfx = new byte[stream.Length];
                    stream.Read(pfx, 0, pfx.Length);
                }
                X509Certificate2 cert = new X509Certificate2(pfx, "pfxPassword");
                X509Store store = new X509Store(StoreName.TrustedPublisher
                    , StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadWrite);
                store.Add(cert);
                store.Close();
                msg = "Certificate installed";
            }
            catch (Exception e)
            {
                msg = e.ToString();
            }
            Console.WriteLine(msg);
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM