Reputation: 1
Am trying to develop a tool ( using windows forms ) in C# .Net. I have an MSI File and a MST ( Transform file ) already generated. I have to first read the msi file ( get as input from user using form menustrip menu item ), then read the mst file ( same as the way msi got as input). Next,create a temporary msi ( may be in temp location) by copying the inputted msi and apply the transform to that temp msi. Then, I can query the msi tables ( merged with mst) as per my requirements. am using Visual Studio 2010 Professional edition. here is the piece of code i have written to my knowledge using windows installer reference library.
using System;
using System.ComponentModel;
using System.Windows.Forms;
using WindowsInstaller;
using System.Xml;
using System.IO;
//// Create an Installer instance
Type classType = Type.GetTypeFromProgID("WindowsInstaller.Installer");
Object installerObj = Activator.CreateInstance(classType);
Installer installer = installerObj as Installer;
Database database = Installer.OpenDatabase(File_MSI,MsiOpenDatabaseMode.
msiOpenDatabaseModeTransact);
database.ApplyTransform (File_MST, MsiTransformError.msiTransformErrorViewTransform);
WindowsInstaller.View viewmst = null;
string sqlquerymst = string.Format("Select * FROM _TransformView");
viewmst = database.OpenView(sqlquerymst);
viewmst.Execute(null);
database.Commit();
viewmst.Close();
string sql = String.Format("Select Property,Value FROM Property");
WindowsInstaller.View view = database.OpenView(sql);
view.Execute(null);
Upvotes: 0
Views: 1611
Reputation: 32240
Although it's not clear what problem you're facing with, I have some general recommendations for you:
Database
class and its ApplyTransform()
method(s)Hope this can help you in any way.
Upvotes: 1