在VS安装程序自定义操作中使用cmd.exe [英] Using cmd.exe in a VS Setup Custom Action
问题描述
我将自定义操作设置为cmd.exe并添加了以下参数:
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
我正在尝试:
a)停止命令屏幕,以便我可以阅读
a) stop the command screen so I can read it
b)将结果写入文件,以便我可以读取。
b) write the results to a file so I can read it.
[ENVIRONMENTUTTON]应该等于质量检查-我是从显示4个单选按钮的对话框中选择的。 [SETTINGSFILE]是用户输入的字段,也是对话框形式。
[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.
命令窗口闪烁,我没有时间阅读它,也没有创建log.txt。
The command window flashes by, I don't have time to read it, and no log.txt is created.
最初,我试图仅运行XmlPreProcess.exe,但是同样的问题,它被给出了一个错误,但我看不到调试它的错误。
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.
相关问题:
了解.MSI详细跟踪-运行CustomAction
如何在MSI / Setup项目中调试自定义操作的失败
尝试过一次:msiexec / i C:\MyPackage\Example.msi / L * V C:\log\example.log
但没有都提供了很多有用的信息-仅确认我的值已正确替换在[SETTINGSFILE]和[ENVIRONMENTUTTON]中。
Tried this once: msiexec /i "C:\MyPackage\Example.msi" /L*V "C:\log\example.log" but didn't give much useful either - only confirmed that my values were substituting correctly in [SETTINGSFILE] and [ENVIRONMENTUTTON].
我正在发布新问题,因为现在专门处理cmd.exe。
I'm posting as a new question because now I'm dealing specifically with cmd.exe.
推荐答案
一些建议:
- 您想使用 / c代替 / k(执行命令后停止 / c)
-
> log.txt将输出写在执行的文件,最有可能在Temp文件夹中(在其中提取了自定义操作);您可以尝试执行以下操作:
- 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
>"[DesktopFolder]log.txt"
在较新的Windows版本上,只有在使用提升的命令窗口时才能创建 C:\log\example.log
on newer Windows versions "C:\log\example.log" can be created only if you use an elevated command window
我希望这会有所帮助。
这篇关于在VS安装程序自定义操作中使用cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!