i have set of instancetransforms defined on wix side, per below:
<instancetransforms property="instanceid"> <instance productcode="*" upgradecode="$(var.upgradecode)" productname="productname $(var.versiontext) (64 bit)" id="$(var.instanceid)"/> <instance productcode="*" upgradecode="$(var.upgradecode1)" productname="productname $(var.versiontext) (64 bit)" id="$(var.instanceid1)"/> <instance productcode="*" upgradecode="$(var.upgradecode2)" productname="productname $(var.versiontext) (64 bit)" id="$(var.instanceid2)"/> <instance productcode="*" upgradecode="$(var.upgradecode3)" productname="productname $(var.versiontext) (64 bit)" id="$(var.instanceid3)"/> <instance productcode="*" upgradecode="$(var.upgradecode4)" productname="productname $(var.versiontext) (64 bit)" id="$(var.instanceid4)"/> </instancetransforms>
i retrieved productcodes of instance transforms through bootstrapper c# windows application evokes .msi. since productcodes generated dynamically during installer's build, thought have query msi using microsoft.deployment.windowsinstaller assembly. however, in examining .msi orca, can't seem find table allow me query productcodes of instance transforms. property table has productcode of product element.
is possible retrieve productcodes of instance transforms? when attempt same version upgrade same installer, see productcode corresponding instancetransform in .msi's error log:
specified instance {8f97345e-ddad-4f03-9d17-820e929c59fe} via transform installed. msinewinstance requires new instance not installed.
if me out one, that'd great - lot in advance!
this how did it(using bootstrapper).i check next available instance transform . can check in registry keys , next available:
public static string[] checkregkeys(product product) { var productenvironment = mapproducttostring.mapproductenvironment(product); var productkeys = new string[50]; (var = 0; < productkeys.length; i++) { if (i < 9) { productkeys[i] = string.format("{0}#0{1}", productenvironment, + 1); continue; } productkeys[i] = string.format("{0}#{1}", productenvironment, + 1); } return productkeys; } public static string findnextenvironmentforinstallation(product product) { var productname = mapproducttostring.mapproducttoregistryname(product); var productkeys = checkregkeys(product); using (var componentskey = registry.localmachine.opensubkey(string.format(@"software\wow6432node\{0}", productname), false)) { if (componentskey == null) { registry.localmachine.createsubkey(string.format(@"software\wow6432node\{0}", productname)); return string.format("i0{0}", 1); } var environments = componentskey.getsubkeynames(); if (environments.length <= 0) { var result = string.format("i0{0}", 1); return result; } (var = 0; < productkeys.length; i++) { if (environments.length < + 1) { if (i < 9) { var result = string.format("i0{0}", + 1); return result; } var result2 = string.format("i{0}", + 1); return result2; } } } return null; }
next send value msi :
using (var p = new process()) { var info = new processstartinfo { windowstyle = processwindowstyle.hidden, filename = @"c:\windows\system32\cmd.exe", arguments = string.format("/c msiexec /i \"{0}\\{6}.msi\" pathname=\"{0}\" sslcertpath=\"{1}\"" + " msinewinstance=1 transforms=\":{2}\" /l*v \"{0}\\{6}log.txt\"" , xmlsettings.environmentfolderpath, findcertificates.sslcertpath, environment), useshellexecute = false, createnowindow = true }; p.start(); p.waitforexit(); }
Comments
Post a Comment