Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Outlook COM加载项已安装但未在Outlook中加载_C#_Visual Studio 2010_Outlook_Vsto_Add In - Fatal编程技术网

C# Outlook COM加载项已安装但未在Outlook中加载

C# Outlook COM加载项已安装但未在Outlook中加载,c#,visual-studio-2010,outlook,vsto,add-in,C#,Visual Studio 2010,Outlook,Vsto,Add In,我已经使用Visual Studio 2010创建了一个Outlook加载项,该加载项安装良好,并按照我的指定在程序文件(x86)中创建相应的注册表项和文件夹,并显示在“添加和删除程序”中 但是,当我启动Outlook 2010时,它不会显示,当我检查COM加载项时,它在列表中不可用。我在VS中创建了设置,并像往常一样在文件系统中添加了主项目的输出,还包括.vsto文件 任何人都可以使用任何指针吗?因为您正在运行x64 OS和x64 Office,所以您不需要使用Wow6432Node-这是一个

我已经使用Visual Studio 2010创建了一个Outlook加载项,该加载项安装良好,并按照我的指定在程序文件(x86)中创建相应的注册表项和文件夹,并显示在“添加和删除程序”中

但是,当我启动Outlook 2010时,它不会显示,当我检查COM加载项时,它在列表中不可用。我在VS中创建了设置,并像往常一样在文件系统中添加了主项目的输出,还包括
.vsto
文件


任何人都可以使用任何指针吗?

因为您正在运行x64 OSx64 Office,所以您不需要使用
Wow6432Node
-这是一个很好的方法。下面是供您使用的正确注册表配置单元

所有用户配置单元(x64操作系统上的x64办公室)
请参阅。

您可以通过HKLM为所有用户运行外接程序,而无需ClickOnce,使用此难以找到的技巧:

在VSTO清单路径值之后放置管道和“vstolocal”标志,因此:

在HKLM\Software\Microsoft\Office\Outlook\Addins\MyVSTOAddIn上 manifest=“C:\Program Files\Publisher\MyVSTOAddIn\MyVSTOAddIn.vsto | vstolocal”

(见:)

并设置EnableLocalMachineVSTO标志,如下所示:

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

(见:)

此外,如果要安装到64位版本的Windows,则必须在另一个位置使用两个值启用本地计算机安装:

在HKLM64\SOFTWARE\Microsoft\VSTO运行时设置\v4上 (DWORD)使能VSTOLOCALUNC=1
(DWORD)EnableLocalMachineVSTO=1

(见:)

无需旁站、无PromptingLevel、无VSTO\Security\Inclusion、无需活动安装\安装组件“StubPath”!只需安装并运行

添加于2013年3月10日…

结果还表明,Win64中的Outlook 2010在信任VSTO加载项方面还有更大的困难,除非您使用真正的代码签名PFX对其进行签名,并将证书放入用户机器的受信任的发布者存储区。我编写了这个命令行实用程序,将PFX嵌入到可执行文件中,使证书成为安装过程的一部分。要获得对本地计算机受信任发布者存储的访问权限,必须以管理员身份运行:

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);
        }
    }
}

这可能不是您的问题,但是:要加载在HKEY_LOCAL_计算机下注册的加载项,计算机必须安装修补程序包976477。有关更多信息,请参阅。感谢您的建议,但我不想提及我正在运行Windows 7 x64和office 2010 x64,并且修补程序仅适用于office 2007。我已经将注册表放入正确的配置单元WOW6432节点。谢谢SilverNinja。我已在注册表中进行了更改,应用程序的安装与以前一样正常,但没有添加到Outlook中的COMAddin。但是,当我转到安装目录并双击MyOutlookAddin.vsto时,它安装得很好。有什么建议吗?所以我创建了MSI并运行了它,它仍然将注册表放在WOW6432节点中,尽管Office和Windows都是x64。然后我导出MyOutlookAddin配置单元并对其进行编辑,使其指向HKEY\U LOCAL\U MACHINE\Software\Microsoft\Office\Outlook\Addins。打开Outlook,猜猜看……加载项出现了。下一个问题,如何将注册表项添加到Visual Studio中的normal和Wow6432Node配置单元?@James-您应该标记此问题已回答,并创建一个新问题供后续跟进,链接到此原始帖子以供参考。可以。为忍者干杯。下一个问题:
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);
        }
    }
}