安装期间运行 MSI

发布于 2024-09-17 19:00:19 字数 594 浏览 2 评论 0原文

我正在寻找一个 .net 应用程序的安装程序,它需要运行一些其他 MSI。由于一次只能运行一个 MSI 的限制(老实说,是 1995 年吗?),并且我希望提供要运行的 MSI 的可配置性,因此我不能像推荐的那样将 MSI 放入引导程序中实践。我发现了一个类似的问题,但对回复并不满意。

作为替代方案,是否有一个基于 .net 的安装程序框架可用于自定义安装过程?我熟悉 IzPackInstallJammerNSIS 但所有这些都使用非 .net 语言,并且如果 .net 商店有点害怕其他技术,则可以使用此方法。

I am looking to make an installer for a .net application which requires a few other MSI be run. Because of the restriction that you can only run one MSI at a time(honestly, is it 1995?) and my desire to provide configurability of which MSIs to run I can't just shove the MSIs in a bootstrapper as seems to be the recommend practice. I found a similar question but no joy on the response.

As an alternative is there a .net based installer framework which could be used to customize the install process? I am familiar with IzPack, InstallJammer and NSIS but all of these use non-.net languages and this if for a .net shop who are a bit scared of other technologies.

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

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

发布评论

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

评论(2

一张白纸 2024-09-24 19:00:19

如果您可以使用他们的 UI 或简单地使用 WiX 风格的 UI,WiX 可以解决这个问题。

如果你想要更丰富的 UI 体验,你需要编写一个自定义引导程序。我过去通过编写一个客户引导程序解决了这个问题,该引导程序向用户提供了统一的 UI,并使安装看起来像单个包,而实际上安装是按顺序运行的 MSI 文件的集合。

以下是我所做工作的总体要点:

  • Bootstrapper 是 .NET 托管代码。优点:更容易编写。缺点:某些系统没有 .NET,我必须为我的托管引导程序提供一个小型非托管引导程序,该引导程序首先部署 .NET,然后启动托管引导程序。
  • 发现了 MSI 文件(app.config 有效...我的应用程序更复杂)。
  • 使用托管 MSI API 读取每个 MSI 文件功能列表
  • 在 .NET winforms 中构建单个“功能选择”向导页面,为每个 MSI 文件创建顶级功能,然后填充从每个 MSI 文件读取的子功能。
  • 根据功能选择和其他选项(卸载、修复、升级等)创建 MSI 命令行。
  • 为“套件”安装程序创建了一个卸载注册表项,并隐藏了特定于 MSI 的卸载项,以便“添加/删除程序/程序和”中只有一个条目。特征。

细节决定成败,但它确实有效,而且效果很好!

编辑 2010 年 9 月 3 日添加更多注释:

如果您采用这种方法,需要考虑以下一些事项:

  • 维护模式体验如何?您可能需要将引导程序缓存在系统上的某个位置,以便在从 ARP 启动时可以打开它。
  • 升级和卸载怎么样?您是否允许升级某些 MSI 而不允许升级其他 MSI?
  • 如何检测升级与维护模式?几乎您必须扫描所有 MSI,如果这些 MSI(认为是“功能”)中的任何一个已过时,那么您将作为升级运行,而不是维护。
  • 考虑添加部分功能...您支持仅安装部分 MSI 吗?在这种情况下,可以进入升级一些并重新安装其他场景。
  • 您最终可能会为整个套件引入套件版本的概念。不要欺骗自己...这只是一个人类/营销版本...只有 MSI 的版本才重要,并且只有这些版本才应该用于确定安装/修复/升级等。

基本上,在创作安装时(无论是单个MSI 或复合套件安装)确保您布局整个软件生命周期的所有用例。很容易以短视的方式编写安装程序,然后在 v2 发布时发现自己陷入了一个不愉快的困境。

祝你好运 ;)

WiX solves this problem if you're okay using their UI or doing simply WiX-style UI.

if you want a richer UI experience you need to write a custom bootstrapper. I have solved this problem in the past by writing a customer bootstrapper which presented a unified UI to the user and made the install look like a single package where in reality the install was a collection of MSI files that were run in sequence.

Here's the general gist of what I did:

  • Bootstrapper was .NET managed code. Pros: easier to write. Cons: some system's didn't have .NET and I had to have a small unmanaged bootstrapper for my managed bootstrapper that deployed .NET first and then launched the managed bootstrapper.
  • Discovered the MSI files (app.config works... my app was more complicated).
  • Used managed MSI API to read each MSI files feature list
  • Built a single "feature selection" wizard page in .NET winforms that created top-level features for each MSI file and then populated the sub features as read from each MSI file.
  • Create MSI command lines based on the feature selection and other options (uninstall, repair, upgrade, etc).
  • Created a Uninstall registry key for the "suite" installer and hid the MSI-specific uninstall keys so that there was only a single entry in Add/Remove Programs / Programs & Features.

The devil's in the details, but it worked and it worked well!

Edit 9/3/2010 with more notes:

Here are some things to consider if you take this approach:

  • What is the maintenance mode experience? You probably need to cache your bootstrapper on the system somewhere so that it can open when launched from ARP.
  • What about upgrades and uninstalls? Do you allow for upgrades of some MSI's but not others?
  • How do you detect upgrade versus maintenance mode? Pretty much you have to scan all the MSIs and if any of these MSI's (think "features") are out of date then you are running as an upgrade, not maintenance.
  • Consider partial feature adds... do you support installing only some of the MSI's? In that case it is possible to get into the upgrade some and fresh-install others scenarios.
  • You'll probably end up introducing the concept of a suite version for the overall suite. Don't kid yourself... that's just a human/marketing version... only the versions of the MSI's matter and only those versions should be used to determine install/repair/upgrade, etc.

Basically, when authoring installs (whether single MSI or composite suite install) make sure you lay out ALL of your use-cases for the entire software lifecycle. It's very easy to write an installer in a shortsighted manner and then find yourself painted into an unpleasant corner when v2 comes out.

Good luck ;)

⊕婉儿 2024-09-24 19:00:19

我使用 WiX 创建 MSI,然后用一个非常小的 NSIS 脚本将它们打包到 .exe 中。我与微软的项目进行过交谈,他们自己也经常使用它。如果您发现 XML 令人畏惧,可以使用一些工具来帮助您使用它。

即使您坚持按照自己的方式制作 MSI,我仍然会推荐使用 NSIS 来生成 .exe。脚本通常非常小。

I use WiX to create the MSI, and then package them into .exe with a very small NSIS script. I've talked to projects at Microsoft, and they use it themselves a lot. There are tools out there that help you use it if you find the XML daunting.

Even if you stick to making the MSI's the way you do, I would still recommend NSIS for the .exe. The scripts are usually pretty tiny.

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