views:

407

answers:

1

For a custom action, I'm setting to Name to XmlPreprocess.exe (a CodePlex utility)

and arguments to: /x:"[SETTINGSFILE]" /i:"[TARGETDIR]web.config" /e:[ENVIRONMENTBUTTON] [CUSTOMSETTINGS] >[TARGETDIR]XmlPreProcess.log

SETTINGSFILE is supposed to be coming from a custom form page I added, and ENVIRONMENTBUTTON is the value of one of my radio buttons.

Is there any way to get the redirect to work? It's not creating the .log file. Is there any other way to see the results of the custom action? How can I even confirm if it ran? What if I would like to see what parms were sent to it?

Update 3: - For more scenarios of what I have tried, see here: http://xmlpreprocess.codeplex.com/Thread/View.aspx?ThreadId=79454

Thanks,

Neal

Update: I just wrote a quickie VBScript to verify my parms.

dim fso, oFile 
set fso = Createobject("Scripting.FileSystemObject") 
set oFile = fso.CreateTextFile("VBScriptOut.txt") 

if WScript.Arguments.Count < 2 then 
   oFile.Writeline("Number of arguments was only = " & WScript.Arguments.Count)
else 
   oFile.WriteLine("SETTINGSFILE=" & WScript.Arguments.Item(0))   
   oFile.WriteLine("ENVIRONMENTBUTTON=" & WScript.Arguments.Item(1))
end if 

oFile.close

No VBScriptout.txt was created, so I don't think it even ran (so my guess is the XmlPreprocess isn't even running either).

I included the InstalLVerification.vbs file as a Custom Action under "Install". I set the condition= True in the properties window. I set CustomActionData to: "[SETTINGSFILE]" [ENVIRONMENTBUTTON]

Update 2: I realized now Condition should not be "True". I either blank it out or set it to "Not Installed".

I'm getting an unexplained error on XmlPreprocess, and I cannot get the VBScript to run. I tried running it also with CScript64.exe.

+1  A: 

Only the command prompt (and occasional other tools) use the greater-than symbol to indicate output redirection. Windows Installer just calls the Win32 CreateProcess API which does not process this symbol. Thus your attempt to log the results will not work. Perhaps you can rewrite your command to look like cmd.exe /c XmlPreprocess.exe /x ... > [TARGETDIR]XmlPreprocess.log (some extra quoting may be required).

For debugging purposes, you can generally get a lot more information by taking a verbose log of the installation process. It will include a listing of properties, and of custom actions it launched and their return codes. I think it will even include the fully formatted command line passed to the application in your case.

Like you say in Update 2, note that a condition of True actually means to look up whether a property of the name True is defined. If you want something that's always true, use the value 1.

Michael Urman
Big thanks - I didn't know you turn on log. Here's how: http://www.advancedinstaller.com/user-guide/qa-log.html
NealWalters
Now see new question: http://stackoverflow.com/questions/2007635/making-sense-out-on-msi-verbose-trace-running-a-customaction
NealWalters
Fresh start now with the cmd.exe http://stackoverflow.com/questions/2050184/using-cmd-exe-in-a-vs-setup-custom-action
NealWalters

related questions