c# - 从 .msi 读取平台信息

标签 c# installation windows-installer orca dtf

我正在使用 Microsoft.Deployment.WindowsInstaller 库从 .msi 文件中读取值。 properties没问题,summary-information也能读出来,例子:

 static void Main(string[] args)
 {
    using (var database = new QDatabase(@"C:\myMsi.msi", DatabaseOpenMode.ReadOnly))
    {
         Console.WriteLine(database.ExecutePropertyQuery("ProductVersion"));
         Console.WriteLine(database.ExecutePropertyQuery("ProductName"));
         Console.WriteLine(database.ExecutePropertyQuery("Manufacturer"));
         Console.WriteLine(database.ExecutePropertyQuery("ARPREADME"));
     }
 }

QDatabase 对象甚至有一个很好的SummaryInfo 属性,用于保存摘要信息。但是,我还没有找到如何获取 .MSI 适用的平台。

好像可以读出platform,Orca也是这样(在Orca打开Summary Information可以看到platform)

如何获得 .msi 的目标平台?

最佳答案

您正在使用一个旨在对数据库进行 LINQ 查询的类。 ExecutePropertyQuery 是一种简化查询 Property table 的方法.正如您所指出的,您要查找的信息不在属性表中,而是在 Summary Information Stream 中。 .具体来说:

Template Summary property

using Microsoft.Deployment.WindowsInstaller;
using(Database database = new Database(PATH_TO_MSI, DatabaseOpenMode.ReadOnly))
{
  Console.WriteLine(database.SummaryInfo.Template);
}

QDatabase 类还公开了 SummaryInfo 属性,因为它扩展了 Database 类。

Queryable MSI database - extends the base Database class with LINQ query functionality along with predefined entity types for common tables.

关于c# - 从 .msi 读取平台信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26888630/

相关文章:

iphone - 可执行文件使用无效的权利进行签名

cassandra - 如果我在 cassandra.yaml 文件中指定 row_cache_size_in_mb =5Gb,那么 cassandra 是否会从堆内存中保留 5GB?

c# - C#中的命名空间和Java中的包之间的区别

c# - 如何在 VB.NET 或 C#.NET 代码中从雅虎邮件 ID 发送邮件

c# - 将自定义 winforms 应用程序创建为安装程序是不好的做法吗?

windows - 由于不正确的 MSI 检索,补丁程序删除一直失败

windows - 错误 1920 服务启动失败。确认您有足够的权限启动系统服务

wix - 如何使用 WiX 检测应用程序是通过 ClickOnce 安装的?

c# - 抽象类与普通类继承性能

c# - 如何在紧凑的框架中访问.Net 性能计数器?