开发者

Using cmd.exe in a VS Setup Custom Action

开发者 https://www.devze.com 2022-12-16 07:33 出处:网络
I set my Custom Action to cmd.exe and adding these arguments: /K XmlPreProcess.exe /x:\"[SETTINGSFILE]\" /i:\"[TARGETDIR]web.config\" [CUSTOMSETTINGS] /e:[ENVIRONMENTBUTTON] >log.txt

I set my Custom Action to cmd.exe and adding these arguments:

/K XmlPreProcess.exe /x:"[SETTINGSFILE]" /i:"[TARGETDIR]web.config" [CUSTOMSETTINGS] /e:[ENVIRONMENTBUTTON] >log.txt 

I'm trying to either:

a) stop the command screen so I can read it

b) write the results to a file so I can read it.

[ENVIRONMENTUTTON] should be equal to QA - which I selected from a dialog form showing 4 radio buttons. [SETTINGSFILE] is a user-entered field also a a dialog form.

The command window flashes by, I don't have time to read it, and no log.txt is created.

Original I was trying to run just XmlPreProcess.exe, but same problem, it was given an error and I couldn't see the error to debug it.

Related questions: Making sense out on .MSI verbose trace - running a CustomAction How to debug failure of a custom action in an MSI/Setup project

Tried this once: msiexec /i "C:\MyPackage\Example.msi" /L*V "C:\log\example.log" but didn't give much 开发者_Go百科useful either - only confirmed that my values were substituting correctly in [SETTINGSFILE] and [ENVIRONMENTUTTON].

I'm posting as a new question because now I'm dealing specifically with cmd.exe.


Which sequence is the custom action running in, and in what context?


Some suggestions:

  • you want to use "/c" instead of "/k" ("/c" stops after executing the command)
  • ">log.txt" writes the output next to the executed file, which is most likely in the Temp folder (custom actions are extracted there); you can try something like this:

    >"[DesktopFolder]log.txt"

  • on newer Windows versions "C:\log\example.log" can be created only if you use an elevated command window

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消