使用内部CAB将外部CAB添加到MSI [英] Adding an external CAB to an MSI with an internal one

查看:217
本文介绍了使用内部CAB将外部CAB添加到MSI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Visual Studio安装程序(vs2015),用于安装应用程序。我希望它也安装一组配置文件,这些文件的内容因物理安装位置而异,这些文件将作为cab文件在与msi相同的目录中提供。驾驶室具有一组已知文件,这些文件将分布在安装位置的2个文件夹中,并且由与安装程序不同的项目创建。如何获得msi来安装其内部内容和外部cabinet文件的内容?

I have a visual studio installer (vs2015) that installs an application. I want it to also install a set of configuration files, the contents of which vary by physical install location, that will be delivered as a cab file in the same directory as the msi. The cab has a known set of files that will be distributed across 2 folders in the install location and is created by a different project than the installer. How do I get the msi to install both its internal contents and the contents of the external cabinet file?

推荐答案

Wise Package Studio



我实际上已经成功地用新文件更新了MSI文件,可以使用 Wise Package Studio 进行安装。它在 Cabs表中添加了一个CAB文件(我不知道此表实际上是Wise的视图还是真正的MSI表-如果Orca缺少,所有CAB都嵌入在MSI中。 Media表中有一个相应的条目,其中 LastSequence 值(在Media表中)描述了哪个CAB包含哪些内容。文件。在文件表中,您将找到一个名为 Sequence 的字段,该字段指定列出文件的顺序。本质上,您的新文件将位于订单的末尾,因此位于新的CAB中。

Wise Package Studio

I actually successfully updated MSI files with new files to install using Wise Package Studio back in the day. It added a CAB file to the Cabs table (I don't know if this table is actually a Wise "view" or a real MSI table - it seems missing from Orca if all CABs are embedded in the MSI). There is a corresponding entry in the Media table where the LastSequence value (in the Media table) describes which CAB contains what files. In the File table you will find a field called Sequence which specifies the "order" of the files listed. Essentially your new files will be at the end of the "order" and hence in a new CAB. A bit involved the whole thing.

但是,我成功地让Wise Package Studio嵌入了新的CAB文件,并使用外部CAB文件安装新文件。在安装过程中,但是我没有记录该过程,也不记得所有步骤。此外,我不推荐该程序-实际上,我现在永远不会使用这种方法。它只是在我当时工作的地方使用过。 在大多数情况下,我们使用转换将内容添加到主程序包中,而不是入侵MSI本身。

However, I successfully got Wise Package Studio to both embed a new CAB file, and to use an external CAB file to install the new files during installation, but I don't have the procedure documented and don't recall all the steps. Moreover I don't recommend the procedure - in fact I would never use this approach now. It was just used at the place I worked at the time. In most cases we used a transform to add this content to the main package, rather than hacking the MSI itself.

在MSI SDK中记录了将CAB文件添加到MSI的过程:< a href = https://msdn.microsoft.com/zh-cn/library/windows/desktop/aa369279%28v=vs.85%29.aspx rel = nofollow noreferrer> 包括文件柜文件在安装中 。相当多-正如我所说,但绝对有可能。如您所见,媒体表中CAB名称的开头缺少标志表示外部CAB文件。

The procedure to add a CAB file to your MSI is documented in the MSI SDK here: Including a Cabinet File in an Installation. Quite involved - as I said, but definitely possible. As you will see the lack of a # flag at the start of the CAB name in the Media table indicates an external CAB file.

简而言之,我想:


  1. 在文件表中添加一个新条目,将序列号设置为+1从已经存在的最高顺序文件条目开始。我也会在 Component表中添加一个新的对应条目。

  2. 媒体表,在 LastSequence 列中指定为文件设置的编号。将您的Cabinet文件的名称添加到 Cabinet 。确保不要在CAB名称前加上

  3. 明智的做法还可以在 MsiFileHash表。不知道这是否是必需的。相当确定不需要在此处添加条目。

  4. 正如在链接的MSI SDK文章中将看到的那样,您可以按照链接的MSDN内容中列出的最后几个步骤来嵌入整个驾驶室。

  1. Add a new entry to the file table, set the Sequence number to +1 from the highest sequence File entry already there. I would add a new, corresponding entry in the Component table as well.
  2. Add a new row to the Media table, specify the number you set for the file in the LastSequence column. Add the name of your cabinet file to Cabinet. Make sure to not prefix the CAB name with #.
  3. Wise would also add entries in the MsiFileHash table. Not sure if this is required or not. Pretty sure it is not required to add entries here.
  4. As you will see in the linked MSI SDK article, you can embed the whole cab following the last few steps listed in the linked MSDN content.

我希望我有时间测试所有这些,但我没有。

I wish I had time to test all this, but I don't. Which brings me to the next point:

当我看到类似这样的问题时,我总是会问自己:这些文件中的内容是什么??它们实际上是默认设置,而不是硬编码在配置文件中的简单设置吗?这多次为我节省了很多工作。

When I see questions like these I invariably ask myself: what is in these files? Are they "trivial settings" that could actually be defaulted instead of hard coded in config files? This has saved me a lot of work, many times.

对于MSI和旧式安装程序来说,设置和数据文件的部署一直存在问题强>。我部署此类文件的理念是将安装的内容视为只读,然后将其复制到每个用户的位置,或在应用程序启动时在HKCU中进行设置,使用一些理智的过程来获取适当的值(从写入的设置中)在安装过程中从HKLM获取,从用户检索,从Internet检索等)。请在以下主题上查看以下更长的答案:在当前用户配置文件中通过管理配置文件创建文件夹和文件。在我看来,最好的方法是从在线数据库中检索启动时的设置(您将看到是否阅读了链接的内容),但这涉及到。

The deployment of settings and data files have always been problematic with both MSI and legacy style installers. My philosophy of deployment for such files is to treat what you install as "read-only" and then you copy them to per-user locations or set them in HKCU on application launch, using some sane process of obtaining appropriate values (from settings written to HKLM during installation, retrieved from the user, retrieved from the Internet, etc...). Please see this longer answer on the subject: Create folder and file on Current user profile, from Admin Profile. The best approach, in my opinion, is to retrieve settings on launch from an online database (as you will see if you read that linked content), but that is involved.

这篇关于使用内部CAB将外部CAB添加到MSI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆