我的 VSTO 3.0 Outlook 插件无法加载

发布于 2024-08-02 16:19:45 字数 952 浏览 3 评论 0原文

我试图诊断为什么用 C#/VSTO 3.0/VS 2008 编写的 Outlook 插件在安装后无法加载。

该插件在我安装了 Visual Studio 2008 的开发计算机上运行得非常好。不过,我不能指望所有用户都具备所有先决条件,因此我按照以下步骤编写了安装程序: http://msdn.microsoft.com/en-us/library /cc563937(loband).aspx

我在全新的 Windows XP SP 2 计算机上安装了该加载项,并全新安装了 Outlook 2007。它安装了所有先决条件(.NET 3.5、VSTO 3.0 运行时、Windows Installer) 3.1,2007 年 PIA)。 Outlook 启动,但加载项未运行。如果我转到信任中心的“加载项”选项卡,我会在“非活动应用程序加载项”部分中看到我的加载项,并显示消息“未加载。加载 COM 加载项期间发生运行时错误” .”。

不知道如何找到特定的错误,以便我可以修复它。

注册表键看起来没问题。在 HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\BlahAddin 下,我看到 Description、FriendlyName、LoadBehavior(设置为 3,直到失败,然后设置为 2)和 Manifest。

尝试了 VSTO_SUPPRESSDISPLAYALERTS 环境变量技巧,然后从命令行启动 Outlook,但没有输出。

我的远程调试或多或少可以工作,但我不确定要寻找什么。当我附加到 Outlook 时,我没有看到我的 DLL 已加载,但话又说回来,托管 DLL 在 VS 中可能不会以相同的方式显示。

关于后续步骤我可以遵循以产生可以诊断的特定错误的任何其他想法吗?

I'm trying to diagnose why my Outlook plugin written in C#/VSTO 3.0/VS 2008 doesn't load after being installed.

The plugin works awesomely on my development machine, which has Visual Studio 2008 installed. I can't expect all my users to have all the prerequisites though so I went through these steps to write an installer:
http://msdn.microsoft.com/en-us/library/cc563937(loband).aspx

I installed the add-in on a fresh Windows XP SP 2 machine with a fresh install of Outlook 2007. It installs all the prereqs ok (.NET 3.5, VSTO 3.0 runtime, Windows Installer 3.1, 2007 PIAs). Outlook starts but the add-in isn't run. If I go to the Add-ins tab in the Trust Center, I see my add-in in the "Inactive Application Add-ins" section with the message "Not loaded. A runtime error occurred during the loading of the COM Add-in.".

Not sure how to find the specific error so I can fix it.

The reg keys look ok. Under HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\BlahAddin I see Description, FriendlyName, LoadBehavior (set to 3 until it fails after which if becomes set to 2), and Manifest.

Tried the VSTO_SUPPRESSDISPLAYALERTS environment variable trick and then launched Outlook from the command line but no output came out.

I have remote debugging more or less working but I'm not sure what to look for. I don't see my DLL loaded when I attach to Outlook, but then again maybe managed DLLs don't show up the same way in VS.

Any other ideas on next steps I could follow to produce a specific error I can diagnose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

暮年慕年 2024-08-09 16:19:45

经过几周的痛苦解决了我的问题。在安装构建过程中,“Manifest”注册表项已损坏为一些垃圾值。这是一个已知的 Visual Studio 错误,据说已在 Visual Studio 2008 SP 1 中修复,但显然不适合我。将项目名称重命名为与插件名称不同可以解决此问题。随机的吧?

Solved my problem after weeks of pain. The "Manifest" reg key was getting corrupted to some junk value during the setup build. It was a known Visual Studio bug that supposedly got fixed in Visual Studio 2008 SP 1, but apparently wasn't for me. Renaming the project name to be different from the plugin name fixed the problem. Random, huh?

几度春秋 2024-08-09 16:19:45

确保 Outlook 调用的所有方法的顶层都有 try-catch 处理程序,并记录您无法以某种方式处理的任何异常。将故障排除重点放在 Startup 方法和初始化期间调用的其他方法等方法上。

Make sure you have try-catch handlers at the top level of all methods called by Outlook and log any exceptions you are unable to handle in some way. Focus your troubleshooting on methods like the Startup method and other methods called during initialization.

我不咬妳我踢妳 2024-08-09 16:19:45

您可能想使用远程调试器对此进行调试。从测试计算机上的开发计算机(在 Program Files 中的 Visual Studio 文件夹中)共享 MSVCMON.EXE 文件夹(与 UNC 路径共享),并在模块和模块中的调试器捕获 (.NET) 异常下启动 Outlook在你的方法中放置断点。

如果您每次在安装解决方案之前都需要清理测试计算机,您可能应该在 Virtual PC 2007 VM(免费下载)下运行 XP,并在设置除插件以外的所有内容后切换到不同的 HD,以对预安装进行快照声明一次,这样您在更改程序以修复错误时就不必继续卸载/重新安装。

您正在安装调试版本还是发布版本?也许一种口味有不同的要求。只是猜测。

-Mike [MSFT Office 开发人员]

You probably want to debug this using the remote debugger. Share out the MSVCMON.EXE folder from your developer machine (in your Visual Studio folders in Program Files) on your test machine (share it with a UNC path), and launch Outlook under the debugger trapping (.NET) exceptions in your modules and putting breakpoints in your methods.

If you need to clean your test computer each time before you install your solution, you should probably run XP under a Virtual PC 2007 VM (free download) and switch to a differencing HD after setting up everything but your plugin to snapshot your pre-installed state once so you don't have to keep uninstalling/reinstalling as you make changes to your program to fix bugs.

Are you installing Debug builds or Release builds? Perhaps one flavor has different requirements. Just guessing.

-Mike [MSFT Office Dev]

雪花飘飘的天空 2024-08-09 16:19:45

在您的计算机上,当您从 Visual Studio 运行插件时,它应该在 HKEY_CURRENT_USER\Software\Microsoft\VSTO\Security\Inclusion{SomeGuid} 中创建一个注册表项。确保这些注册表设置也与您的插件一起部署。它们使您的代码值得信任。

On your machine, when you run the addin from Visual Studio, it should create a registry key in HKEY_CURRENT_USER\Software\Microsoft\VSTO\Security\Inclusion{SomeGuid}. Make sure that these registry settings are also being deployed with your addin. They are the ones that allow your code to be trusted.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文