简体   繁体   English

从.msi中读取平台信息

[英]Read Platform information from .msi

I'm using the Microsoft.Deployment.WindowsInstaller libraries to read out values from a .msi file. 我正在使用Microsoft.Deployment.WindowsInstaller库从.msi文件中读取值。 Properties are no problem, and the summary-information can also be read out, example: 属性没问题,也可以读出摘要信息,例如:

 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"));
     }
 }

The QDatabase object even has a nice SummaryInfo property, holding the summary information. QDatabase对象甚至有一个很好的SummaryInfo属性,包含摘要信息。 However, I haven't found out how to get the platform for which the .MSI is intended for. 但是,我还没有找到如何获得.MSI所针对的平台。

It would seem that platform can be read out, as Orca also does this (the platform can be seen when opening the Summary Information in Orca). 似乎可以读出平台,因为Orca也这样做(在Orca中打开摘要信息时可以看到平台)。

How can I get the platform for which the .msi was intended? 如何获得.msi所针对的平台?

You are using a class that is meant to do LINQ queries of the database. 您正在使用一个用于执行数据库LINQ查询的类。 ExecutePropertyQuery is a method that simplifies querying the Property table . ExecutePropertyQuery是一种简化查询Property表的方法 As you noted the information you seek isn't in the property table, it's in the Summary Information Stream . 如您所知,您所寻求的信息不在属性表中,而是在摘要信息流中 Specifically: 特别:

Template Summary property 模板摘要属性

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

The QDatabase class also exposes the SummaryInfo property also as it extends the Database class. QDatabase类在扩展Database类时也会公开SummaryInfo属性。

Queryable MSI database - extends the base Database class with LINQ query functionality along with predefined entity types for common tables. 可查询的MSI数据库 - 使用LINQ查询功能扩展基本数据库类以及公共表的预定义实体类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM