自定义安装程序操作期间的 UI

发布于 2024-07-06 13:09:19 字数 152 浏览 7 评论 0原文

在自定义安装程序操作期间显示 UI 的正确方法是什么?

我希望我的 UI 在安装对话框中是模态的,或者,我希望有一种方法可以在安装程序日志中显示自定义操作的文本/进度。

安装程序是一个 VS2005 安装项目,自定义操作是一个 C# 安装程序派生类。

What is the correct way to display UI during a custom installer action?

I would like my UI to be modal on the install dialog, or alternatively, I'd like a way to display text/progress from my custom action in the installer dislog.

The installer is a VS2005 setup project and the custom action is a C# Installer-derived class.

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

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

发布评论

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

评论(1

吃颗糖壮壮胆 2024-07-13 13:09:19

显示任何类型的非标准 UI 都需要更改 UI 处理程序对象。 这并非易事,其实现取决于您用来编写 MSI 的工具包:我不确定 VS 设置项目是否可以实现这一点。

不过,通过自定义操作显示简单的状态/进度消息并记录到 MSI 日志并不难,至少不使用 Windows Installer XML (WiX) 工具集,这是我自己用于此目的的工具集。

使用 WiX 创作自定义操作时,您可以通过 Microsoft.Deployment.WindowsInstaller.Session 对象访问活动安装程序会话,该对象具有“Log”(如果启用了日志记录,则将消息写入日志)和“Message”(执行任何已启用的日志记录操作并将执行推迟到与引擎关联的 UI 处理程序对象)功能,以及许多其他好处。

如果您当前已经在 C# 中创建自定义操作,您也许能够在当前环境中找到类似的内容(我从未使用过 VS.net 安装程序项目,所以我不太确定它们是如何工作的 -实际上,我很惊讶这些允许您创建托管自定义操作...)。 否则,我绝对建议您研究 WiX 的自定义操作:它们适用于任何 MSI 创作环境,并且非常灵活。

Displaying any kind of non-standard UI would require changes to the UI handler object. This isn't trivial, and the implementation depends on the toolkit you use to author your MSIs: I'm not sure it's even possible with VS setup projects.

Displaying simple status/progress messages and logging to the MSI log isn't too hard to do from a custom action, though, at least not using the Windows Installer XML (WiX) toolset, which is what I use myself for this purpose.

When authoring your custom actions with WiX, you get access to the active installer session through the Microsoft.Deployment.WindowsInstaller.Session object, which has 'Log' (writes a message to the log, if logging is enabled) and 'Message' (performs any enabled logging operations and defers execution to the UI handler object associated with the engine) functions, amongst many other goodies.

If you're currently already creating your custom actions in C#, you may be able to find something similar in your current environment (I've never worked with VS.net installer projects, so I'm not exactly sure how they work -- I'm quite surprised actually that these allow you to create managed custom actions...). Otherwise, I'd definitely recommend looking into WiX for custom actions: these work with any MSI authoring environment, and are quite flexible.

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