[英]how do i pause cmd screen after msbuild.exe execution or write output in log file?
I tried following code to pause command line screen after execution of msbuild.exe 我尝试以下代码在执行msbuild.exe之后暂停命令行屏幕
var solutionFile = "c:\test\myconsole.sln";
regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5");
var msbuildPath = (string)regKey.GetValue("MSBuildToolsPath");;
var startInfo = new ProcessStartInfo()
{
Arguments = String.Format("\"{0}\" /nologo", solutionFile),
FileName = Path.Combine(msbuildPath, "msbuild.exe")
};
var proc = Process.Start(startInfo);
proc.WaitForExit();
Any argument I can use to pause cmd screen? 我可以用来暂停cmd屏幕的任何参数吗? or write output in log file? 或将输出写入日志文件?
I would try launching msbuild.exe
within and actual cmd.exe as presented here . 我会尝试启动msbuild.exe
并在此处显示实际的cmd.exe。
EDIT 编辑
const string solutionFile = @"c:\test\myconsole.sln";
var regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5");
var msbuildPath = (string) regKey.GetValue("MSBuildToolsPath");
var msBuild = Path.Combine(msbuildPath, "msbuild.exe");
var strCmdText = string.Format("/K {0} \"{1}\" /nologo", msBuild, solutionFile);
var proc = Process.Start("CMD.exe", strCmdText);
// Not necessary if you don't actually want to wait for it to exit before
// proceeding to following code
proc.WaitForExit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.