为 VSTO Outlook 加载项创建 (ClickOnce) 设置

发布于 2024-07-14 18:12:38 字数 1076 浏览 4 评论 0原文

因此,我创建了一个 Outlook 插件并使用单击一次设置来部署它。

当用户是管理员时,设置运行良好,但否则:不行。

使用“运行方式...”运行设置并以管理员身份登录可以正常工作,但加载项安装在管理员下,而不是当前用户下。 该插件未显示在 Outlook 中。

我尝试遵循本指南: http://blogs.msdn.com/mshneer/archive/2008/04/24/deploying-your-vsto-add-in-to-all-users-part-iii.aspx

但是我陷入第一部分: http://blogs.msdn.com/mshneer/archive/2007/09/04/deploying-your-vsto-add-in-to-all-users-part-i.aspx

我关注示例并按所述启动 excel:

现在启动 Excel 应用程序。 检查 HKCU hive 中的注册表项,例如 你会发现两个有趣的 出现在您的注册表项下 香港中文大学蜂巢:

  • HKCU\Software\Microsoft\Office\TestKey 包含注册表值的注册表项 测试值
  • 您现在还拥有 HKCU\软件\微软\Office\12.0\用户 Settings\TestPropagation 注册表项 计数值设置为 1

但在我的机器上,未创建密钥...接下来我可以尝试什么?

So I created an Outlook Add-in and used the click-once setup to deploy it.

The setup runs fine when the user is administrator, but otherwise: no go.

Running the setup with "run as..." and logging in as admin works, but than the add-in is installed under the admin, not the current user. The addin doesn't show up in outlook.

I tried following this guide:
http://blogs.msdn.com/mshneer/archive/2008/04/24/deploying-your-vsto-add-in-to-all-users-part-iii.aspx

But I get stuck at part I:
http://blogs.msdn.com/mshneer/archive/2007/09/04/deploying-your-vsto-add-in-to-all-users-part-i.aspx

I follow the examples and start excel as described:

Now start Excel application. Examine
the registry keys in HKCU hive e.g.
you will find two interesting
registry keys that appear under your
HKCU hive:

  • HKCU\Software\Microsoft\Office\TestKey
    registry key containing registry value
    TestValue
  • You now also have
    HKCU\Software\Microsoft\Office\12.0\User
    Settings\TestPropagation registry key
    with Count value set to 1

But on my machine, the keys are not created... What can I try next?

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

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

发布评论

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

评论(6

未央 2024-07-21 18:12:38

我已经好几年没有这样做了,但从记忆中,office 插件会像这样“注册”:

  1. 将文件放在正确的位置
  2. 注册 .NET COM 对象,该对象代表您的插件
  3. 将注册表项放在 Microsoft\Office\Addins 下 告诉 Office 加载您的 COM 对象。

如果我的想法是正确的,问题将是你需要注册COM对象。 注册 COM 对象是每台计算机的操作,因此需要管理员权限。

您将能够看到这是否确实发生了。 Office 插件下的注册表项将被称为类似 MyAddin.Connect 的名称。 然后,您可以在 HKEY_CLASSES_ROOT 下搜索 MyAddin.Connect,当您以管理员身份运行安装时,它应该存在,而当以管理员身份运行时,它应该不存在。每个用户。

如果是这样,您可以通过按用户注册 COM 对象来解决这个问题,但这有点痛苦。

现在事情可能更容易了,但是当我必须这样做时,您使用了一个名为 RegCap.exe 的实用程序将与 COM 对象关联的注册表项捕获到 .reg 文件中,然后修改 .使用文本编辑器创建 .reg 文件,将 HKLM 替换为 HKCU,然后加载此 .reg 文件,而不是注册 COM 对象。

I haven't done this in a few years, but from memory office addins get "registered" like this:

  1. put files in the right place
  2. register .NET COM object which represents your addin
  3. put registry entries under Microsoft\Office\Addins to tell office to load your COM object.

If my thinking is correct, the problem will be that you need to register the COM object. Registering COM objects is a per-machine action and hence requires admin privileges.

You'll be able to see if this is indeed what's happening. Your registry key under the office addins one will be called something like MyAddin.Connect. You can then search under HKEY_CLASSES_ROOT for MyAddin.Connect and it should be present when you run the install as admin, and not present when running as per-user.

If it is this, you can get around it by doing a per-user registration of the COM object, but this is a bit painful.

Things may be easier these days, but when I had to do it, you used a utility called RegCap.exe to capture the registry entries associated with the COM object into a .reg file, then modify the .reg file with a text editor to replace HKLM with HKCU, then instead of registering the COM object, you load this .reg file.

撞了怀 2024-07-21 18:12:38

需要明确的是,您将注册表项添加到“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\User Settings”,

但它们仍然没有出现在 HKCU\Software\Microsoft\Office\ 中?

我假设你运行的是 64 位操作系统?

如果是这样,修复很简单,请尝试使用

Windows 注册表编辑器版本 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Microsoft\Office\12.0\User Settings\TestPropagation] “计数”=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Microsoft\Office\12.0\User Settings\TestPropagation\Create\Software\Microsoft\Office\TestKey]
"TestValue"="Test"

请注意,该密钥的路径位于 Wow6432Node 密钥下。 它必须位于此处,否则它将无法在 64 位操作系统上运行。

Just to be clear, you are adding the registry keys to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\User Settings"

And they are still not appearing in HKCU\Software\Microsoft\Office\ ?

I assume you must be running a 64bit os?

If so the fix is simple, try this instead

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Microsoft\Office\12.0\User Settings\TestPropagation] "Count"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Microsoft\Office\12.0\User Settings\TestPropagation\Create\Software\Microsoft\Office\TestKey]
"TestValue"="Test"

Notice the path to the key is under the Wow6432Node key. It must be under there or it will not work on a 64 bit OS.

∝单色的世界 2024-07-21 18:12:38

如果要将 Outlook 加载项安装给所有用户,则需要使用共享加载项而不是 VSTO 加载项。 VSTO 加载项是基于每个用户而不是基于每个计算机的,因此对于标准用户,您必须暂时向用户授予本地管理员权限才能安装它。

You need to use shared add-in instead of VSTO add-in if you want to install your Outlook Add-in to all-users. VSTO add-in is per-user basis rather than per-machine, so for standard users you have to temporally give user the local-administrator authorization to install it.

待"谢繁草 2024-07-21 18:12:38

您的加载项针对的是哪个版本的 Office,以及您针对的是哪个版本的 .NET Framework? 另外,您使用的是哪个版本的 Visual Studio?

这应该有效; 我现在有两个正在生产中的 Office 加载项,它们是通过 ClickOnce 部署的。

您列出的文章是关于为所有用户安装的。 这不使用 ClickOnce,并且与您的情况无关。

在找出您正在使用/定位的版本后,我可以为您提供一些部署步骤。 :-)

What version of Office are you targeting with the add-in, and what version of the .NET Framework are you targeting? Also, what version of Visual Studio are you using?

This should work; I have two Office add-ins in production now that are deployed with ClickOnce.

The article you listed is about installing for all users. That does not use ClickOnce, and is irrelevant to your case.

I can give you some steps for deployment after I find out what versions you're using/targeting. :-)

吲‖鸣 2024-07-21 18:12:38

如果我正确理解了这个问题,请让我描述一下您的场景:clickonce 应用程序将为所有用户安装,因此最初必须通过具有管理员权限的部署机制运行,以便将密钥写入 HKLM。 此后,标准用户登录,Microsoft Office 在启动时将 HKLM 密钥复制到 HKCU,此后该加载项将在该计算机上的任何用户的标准用户上下文下运行。

如果在用户启动 Office 时,让 Office 使用 HKLM 密钥复制到 HKCU 的所有尝试都已用尽,我会将 vbs 脚本和 reg 文件放在一起,将 vbs 脚本放在所有用户启动文件中(使用某些管理级别部署)工具)并在 HKCU 中自行管理特殊密钥的创建,无需 Office 的帮助。 当用户登录时,vbs 脚本文件会默默地运行 regedit,将适当的密钥放入 HKCU。

这类似于我们在办公室管理 WordPerfect 的方式。

更新:使用修补程序 KB976477 解决该问题。

If I understand the question correctly, let me describe your scenario: the clickonce app will be installed for all users and therefore must initially be run through a deployment mechanism that has admin privileges in order to write keys to HKLM. After that point, the standard user logs on, Microsoft Office copies HKLM keys to HKCU on startup and the add-in is run under the context of the standard user for any user on that machine thereafter.

If all attempts are exhausted on getting Office to use HKLM keys to copy over to HKCU when a user starts Office, I would throw together a vbs script and reg file, place the vbs script in the all users startup file (using some admin level deployment tools) and manage the creation of the special keys in HKCU myself without Office's help. The vbs script file would silently run regedit to place the appropriate keys in HKCU when a user logs in.

This is similar to how we manage WordPerfect in my office.

Update: Use hotfix KB976477 to address the issue.

近箐 2024-07-21 18:12:38
  1. 创建一个本地管理员帐户,例如 TESTAccount。
  2. 使用单击一次为该用户安装插件。
  3. 以管理员身份重新登录并将 TESTAccount 复制到默认用户。

现在,当任何人登录到计算机时,都会从默认配置文件为他们创建一个新的配置文件,因此将安装插件。

  1. Create a local admin account say TESTAccount.
  2. Install the addin using click once for that user.
  3. Re-login as administrator and copy TESTAccount into default user.

Now so when anybody logs into the machine a new profile would be created for them from default profile and so will have the addin installed.

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