本文介绍了托管 WiX 引导程序包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Bundle.wxs 中链接了多个 Msi/exec 包.在我的托管 Bootstrapper 代码中,我想获取正在执行的当前包的参数(例如 DisplayName、Vital 等).现在,我只找到了提供 packageID 的事件.我可以使用它以某种方式访问​​包的其他属性吗?

I have chained multiple Msi/exec packages in my Bundle.wxs. In my managed Bootstrapper code, I would like to get the parameters (such as DisplayName, Vital, etc) of the current package that is being executed.Right now, I have only found events that provide the packageID. Can I use this to somehow access other properties of the package?

推荐答案

是的.一个名为 BootstrapperApplicationData.xml 的文件是在构建过程中创建的,并包含在您的 Bootstrapper 应用程序中.BootstrapperApplicationData.xml 有很多关于包含在 Bundle Chain 中的包和包的信息,包括 DisplayName和大小和重要.

Yes. A file called BootstrapperApplicationData.xml is created during the build process and included with your Bootstrapper Application. The BootstrapperApplicationData.xml has lots of information about the bundle and packages included in your Bundle Chain, including the DisplayName and sizes and vital.

您会在 .dll 旁边找到 BootstrapperApplicationData.xml.在托管代码中,您可以使用以下代码获取它:

You'll find the BootstrapperApplicationData.xml right next to your .dll. In managed code you can get it using the following code:

 string folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
 string dataXmlPath = Path.Combine(folder, "BootstrapperApplicationData.xml");

在本机代码中,使用 balutil.lib 中提供的辅助函数更容易.即 BalManifestLoad() 然后 BalInfoParseFromXml() 将 XML 文件解析为一堆方便的结构.代码在src\ext\BalExtension\balutil\balinfo.cpp.

In native code, it is easier to use the helper functions provided in the balutil.lib. Namely BalManifestLoad() then BalInfoParseFromXml() to parse the XML file into a bunch of handy structs. You can see the code in src\ext\BalExtension\balutil\balinfo.cpp.

最后,可以通过使用 CustomTable 元素并设置 BootstrapperAppplicationData='yes' 属性来扩展 BootstrapperApplicationData.xml.

Finally, the BootstrapperApplicationData.xml can be extended by using CustomTable elements and setting the BootstrapperAppplicationData='yes' attribute.

这篇关于托管 WiX 引导程序包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 00:26