windows installer - Using the MSI database to detect feature state -
i have msi containing 6 different features. software installed via msi runs in distributed environment (each feature can installed on different machine, run single machine, or combination). creating update routine coordinate update across different machines if necessary. first phase of routine update database schema (one of msi features). if update successful continue update remaining features. there way, using c#, use msi database determine install state of feature? basically, want run check on every machine , determine 1 has database feature installed.
first, don't understand why need of this. if using minor upgrades same features , components reinstalled unless specify otherwise or use transitive/conditional components. during majorupgrade can tell upgradetable entry migrate feature states , you'll same features got before. msi should run on every machine , work.
that said, if want detect feature states using c# windows installer xml (wix) , take @ deployment tools foundation (dtf). dtf has interop library windows installer called microsoft.deployment.windowsinstaller.dll , use this:
using system; using system.collections.generic; using system.text; using microsoft.deployment.windowsinstaller; namespace consoleapplication1 { class program { static void main(string[] args) { productinstallation productinstallation = new productinstallation("{4500f118-6dc7-4a77-94bf-f2409486d8e1}", null, usercontexts.machine); foreach (var feature in productinstallation.features) { console.writeline("{0} {1}", feature.featurename, feature.state.tostring()); } console.writeline("finished"); console.read(); } } } iwd_generalinformation local
iwd local
iwd_namespaces local
iwd_properties local
iwd_filesandfolders local
iwd_customtables local
iwd_xmleditor local
iw local
iswixaddin local
iwd_services absent
iwd_shortcuts absent
finished
Comments
Post a Comment