3

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
zdebyman
  • 550
  • 1
  • 4
  • 22
  • I am not sure but may be you need - http://ant.apache.org/antlibs/dotnet/ which is automated build system and do what you are expecting – Prashant Lakhlani Oct 26 '12 at 13:10

1 Answers1

10

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.

zdebyman
  • 550
  • 1
  • 4
  • 22