Outlook 加载项 ClickOnce 更新设置

发布于 2024-11-30 00:09:55 字数 804 浏览 1 评论 0原文

我正在尝试使用 ClickOnce 部署 Outlook 加载项。 在设置更新选项时,我注意到可用于 Outlook 添加项目的选项少于 Win Forms 项目。例如,我无法指定所需的最低版本。这是为什么?另外,我想:

  1. 启用手动更新
  2. 以询问用户是否需要更新(如果不需要)。

1)我尝试使用 System.Deployment.Application 和 CheckForDetailedUpdate() 函数,但即使更新成功,安装它也会出现问题:如果我重新启动我的插件,它就会从 Outlook 中消失,如果我不这样做,旧版本就会卡在 Outlook 中(并且行为奇怪)尽管通过 UNC 路径进行的进一步更新表明更新已成功完成。

2)使用 Mage 或 MageUI 添加没有特殊选项的常规发布本身可以工作,但加载项似乎无需询问用户即可更新。谷歌搜索一下,发现人们正在尝试做相反的事情,所以我有点困惑为什么它默认不提示更新。

我尝试使用 MageUI 编辑从 Visual Studio 生成的清单,但它为应用程序清单生成无效的 XML(?! - 它错过了“dependentAssembly”节点中的“ assemblyIdentity”节点),并且当我从 VS 生成的原始清单中添加丢失的节点(并更新然后签名),安装抱怨程序集哈希值无效。

如何部署符合上述要求的 Outlook 加载项?

I'm trying to deploy Outlook add-in with ClickOnce.
While setting the update options I noticed that there are fewer options available for Outlook add in project than there are for Win Forms project. For example I cannot specify minimum required version. Why is that? Also, I would like:

  1. to enable manual update
  2. to ask user if he even wants an update (if it is not required).

1) I tried using System.Deployment.Application and CheckForDetailedUpdate() function but even though update succeeds there are problems installing it: If i restart my plugin it disappears from Outlook, if I don't the old version gets stuck in Outlook (and behaves oddly) although further updates via UNC path suggest that update has been successfully done.

2) Regular publish with no special options added with Mage or MageUI works in itself, but add-in seems to update without asking a user. Googling a bit reveils that people are trying to do the opposite, so I'm kind of puzzled as to why doesn't it prompt for update by default.

I tried editing manifests generated from Visual Studio with MageUI but it generates invalid XML for application manifest (?! - it misses "assemblyIdentity" node in "dependentAssembly" node), and when i add missing nodes from original manifest generated by VS (and update and sign it afterwards), installation complains about assembly hashes being invalid.

How can I deploy Outlook add-in with said requirements?

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

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

发布评论

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

评论(1

冷默言语 2024-12-07 00:09:55

VSTO 应用程序(Office 加载项)仅支持 ClickOnce 的某些位。您可以尝试添加代码并进行编程更新,但 Microsoft 的 ClickOnce 负责人表示,它并不是真正打算使用的,并且它的某些部分可能无法工作。 (不,没有具体说明哪些部分的详细信息——您必须进行一些尝试和错误)。

另请注意,vsto 部署的工作和运行方式如下:Outlook 检查 vsto 应用程序,并将 dll 复制到影子位置并使用 Outlook 加载该位置。当您更新 vsto 应用程序时,它会在单击一次缓存中更新它,但不会在 Outlook 中更新。当您关闭 Outlook 并重新打开它时,它会找到新版本,将其复制到影子位置并加载。您无法重新启动 vsto 位本身并让它执行任何操作。用户必须重新启动 Outlook。

这是启动 Office 应用程序时执行更新的原因之一。它会查找新版本,必要时进行更新,然后将其加载到 Outlook 中并使用它。

话虽如此,完成您想要的任务的另一种方法是编写一个 Windows 窗体应用程序来更新您的加载项。基本上部署一个 winforms 应用程序,除了通过 clickonce 调用 vsto 应用程序(process.start 是你的朋友)之外,第一次只显示任何内容。然后,您可以让 Outlook 加载项调用 winforms 应用程序,查看是否有更新,如果有,它可能会提示更新 win forms 应用程序,然后卸载并重新安装 Office 加载项或更新它。

VSTO applications (Office Add-Ins) only support certain bits of ClickOnce. You can try adding code and doing programmatic updates, but the ClickOnce lead at Microsoft said it is not really intended to be used, and parts of it might not work. (No, no details on exactly which parts -- you have to do a bit of trial & error).

Also note that the way a vsto deployment works and runs is this: Outlook checks out the vsto app, and copies the dll(s) to a shadow location and loads that with Outlook. When you update the vsto app, it updates it in the click once cache, but not in outlook. When you close outlook and re-open it, it finds the new version, copies it out to the shadow location, and loads it. You can't restart the vsto bit itself and have it do anything. The user must restart Outlook.

This is one of the reasons that updates are performed when starting up the Office application. It looks for the new version, updates if necessary, and then loads it into Outlook and uses it.

Having said that, another way to accomplish what you want is to write a windows forms app that will update your add-in. Basically deploy a winforms app that just shows nothing the first time except invoke the vsto application via clickonce (process.start is your friend). Then you could have the outlook add-in invoke the winforms app the see if there's an update, and if there is, it could prompt for an update of the win forms app, and then uninstall and reinstall the office add-in or update it.

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