我正在使用 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 中。 .具体来说:
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/