Reputation: 650
I'm making Visual Studio package where I start devenv.exe and try to build other solution. I need to get building output in realtime, so user can see building progress/output, but I don't know how to do it and if it's even possible.
I tried such way :
string rebuildLog = string.Empty;
string logFileName = System.IO.Path.GetTempFileName();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = @"devenv.exe";
psi.Arguments = "\"" + config.DmsPath + "\"" + @" /rebuild" + " Release|x64 " +" /out " + logFileName;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = psi;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
while (!process.StandardOutput.EndOfStream)
{
string line = process.StandardOutput.ReadLine();
MessageBox.Show(line); // just to see if it works. It should go to log form
}
rebuildLog = GetRebuildLog(logFileName);
And rebuildLog has output.
What can I try next?
Upvotes: 3
Views: 1398
Reputation: 650
I found answer. devenv.exe doesn't write simple console output, so i had to change
psi.FileName = @"devenv.exe"; to psi.FileName = @"devenv.com"; and it worked.
Upvotes: 10