[wix-users] [EXTERNAL] - Executing a batch script using custom action before File Copy/Install Files - Help Needed
Lewis Henderson
henderso at opentext.com
Thu Jul 6 07:33:29 PDT 2017
Hi Kathir,
I had a similar requirement - I needed to use batch scripts to interact with an already-installed utility to perform validation prior to InstallExecure. I added the batch files as Binary table entries, then passed those Id's to a couple of custom actions (mine were C instead of C#), one was immediate execution and the other was deferred. I can't post my CA code, but you should be able to find the information you need using a google search for "batch files in wix". The essence is to extract the binary from the installer using MsiOpenDatabase|MsiGetActiveDatabase, MsiDatabaseOpenView (using the Binary ID in the query), MsiViewExecute, and MsiViewFetch, then create a local copy of the batch file on disk using MsiRecordReadStream to populate it, then you can execute the batch script via CreateProcess, or even something as simple as system(). Then of course you'd do your cleanup. For the Immediate CA, I passed the Binary ID and parameters using fixed WiX properties (set in a Dialog) and for the deferred CA I used a semicolon delimited string in the CA Data. For my case, I created the two CA's that only parsed the parameters using the proper methodology, then they both called a common subroutine to perform the binary extraction and execution.
I hope this helps.
Lewis
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Kathiresan Ramasamy Selvaraj
Sent: Thursday, July 6, 2017 7:38 AM
To: wix-users at lists.wixtoolset.org
Subject: [EXTERNAL] - [wix-users] Executing a batch script using custom action before File Copy/Install Files - Help Needed
Hello All,
I am new to WiX Toolset.
I have a requirement to execute a batch script( there are scripts used for some custom pre-requisite check) before the File Copy/ Install Files,
Is there a mean to add the batch script as binary and execute using a C# Custom Action?
Please let me know is there a solution to address this requirement.
Kindly help me in this regard.
Thanks,
Kathir
The information contained in this e-mail message and in any attachments/annexure/appendices is confidential to the recipient and may contain privileged information.
If you are not the intended recipient, please notify the sender and delete the message along with any attachments/annexure/appendices. You should not disclose, copy or otherwise use the information contained in the message or any annexure. Any views expressed in this e-mail are those of the individual sender except where the sender specifically states them to be the views of Toshiba Software India Pvt. Ltd. (TSIP),Bangalore.
Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Toshiba Embedded Software India Pvt. Ltd, for any loss or damage arising in any way from its use.
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueKkO53V282tTn1P4&m=vqY84KEt_4tbAivbH8mtk0BOPVvLF1NQF5pzQGqPmiQ&s=JWijNSkYy2CuFmW2UjMHejeWYCHnCcRFPiUSpueliNM&e=
More information about the wix-users
mailing list