Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerating msi transform using c#
    primarykey
    data
    text
    <p>I am creating a cutomization software which will do all the standardization to a mst file. Below is the code of class that will change product name and genrate transform.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using WindowsInstaller; using System.Data; namespace Automation { class CustomInstaller { public CustomInstaller() { } public Record getInstaller(string msiFile,MsiOpenDatabaseMode mode,string query) { Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer"); Installer inst = (Installer)Activator.CreateInstance(type); Database db = inst.OpenDatabase(msiFile, mode); WindowsInstaller.View view = db.OpenView(query); view.Execute(null); Record record = view.Fetch(); db.Commit(); return record; } public bool generateTrans(string file1, string file2,string transName) { Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer"); Installer inst = (Installer)Activator.CreateInstance(type); Database db1 = inst.OpenDatabase(file1, MsiOpenDatabaseMode.msiOpenDatabaseModeReadOnly); try { Database db2 = inst.OpenDatabase(file2, MsiOpenDatabaseMode.msiOpenDatabaseModeReadOnly); return db2.GenerateTransform(db1, transName); } catch (Exception e) { } return false; } public int editTransform(string msiFile, MsiOpenDatabaseMode mode, string query) { Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer"); Installer inst = (Installer)Activator.CreateInstance(type); Database db = inst.OpenDatabase(msiFile, mode); WindowsInstaller.View view = db.OpenView(query); view.Execute(null); db.Commit(); int o=(int)db.DatabaseState; db = null; inst = null; type = null; return 1; } } } </code></pre> <p>First editTransform() is called which will create a copy of original msi and do some changes in it, then generateTrans() is called which will get difference detween two msi files and create a transform file. Now issue is when genrateTrans() is called, then it goes to catch block of it as inst.OpenDatabase return "MSI Api Error". It seems to me that the copy of file crated by editTransform is still locked by it and is not available for use for generateTrans() menthod. Please help here.</p> <p>PS: mode used for edit transform is transact.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload