c++ - Generate text from MSI made using Wix -
this might sound dummy question, want process parameters given msi file, generated using wix. have developed program visual c++ in vs2010 eg
msiexec /i setup.exe ip="192.168.2.1" port="9999"
i want access parameters ip , port , write in text file as:
{ "ip":"192.168.2.1", "port":"9999" }
is possible in wix? if isn't there way this.
i believe there way this, although haven't done myself.
if pass parameter msiexec following:
msiexec /i setup.exe custompropip="192.168.1.1" custompropport="9999"
then property should set in list of properties msi package can parse. create custom action handle these values , can write file disk.
<binary id="setupca" sourcefile="setupca.ca.dll" /> <customaction id="writefiletodisk" execute="immediate" binarykey="setupca" dllentry="writefiletodisk" />
make sure have custom action in install sequences...
<installexecutesequence> <custom action="writefiletodisk" sequence="2" /> ... </installexecutesequence>
you need custom action project create setupca.ca.dll. code custom action like:
namespace setupca { public class customactions { [customaction] public static actionresult writefiletodisk(session session) { session.log("begin writefiletodisk"); // useful see when firing through log file created during install /l*vx parameter in msiexec // work here... string ipaddress = session["custompropip"]; string ipport = session["custompropport"]; session.log("ending writefiletodisk"); return actionresult.success; } } }
Comments
Post a Comment