private static string GetProductCode() { System.Type oType = System.Type.GetTypeFromProgID("WindowsInstaller.Installer"); Installer inst = System.Activator.CreateInstance(oType) as Installer; Database DB = inst.OpenDatabase("C:\\Users\\user\\Desktop\\Setup.msi", MsiOpenDatabaseMode.msiOpenDatabaseModeReadOnly); string str = "SELECT * FROM Property WHERE Property = 'ProductCode'"; WindowsInstaller.View thisView = DB.OpenView(str); thisView.Execute(); WindowsInstaller.Record thisRecord = thisView.Fetch(); string result = thisRecord.get_StringData(2); return result; }
版权声明:《 C# 获取msi文件的ProductCode 》为zhangkang原创文章,转载请注明出处!
最后编辑:2019-11-21 20:11:54