Hello, im trying to call dumpbin.exe from C# app and capture result back in my app for future processing, but im stuck ... :(
my attempts:
attempt #1:
Process.Start(@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\dumpbin.exe", "/exports LIB.dll")
result: mspdb110.dll not found
attempt #2:
var cmd = Process.Start("cmd.exe /C \"c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat\""); cmd.WaitForExit(); Process.Start(@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\dumpbin.exe", "/exports LIB.dll");
result: same as #1
attempt #3
string temp = Path.GetTempFileName(); string bat = Path.ChangeExtension(temp, ".bat"); File.WriteAllLines(bat, new[] { @"call ""c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""","dumpbin.exe /exports \"" + dll + "\" >> \"" + temp + "\"" }); ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C \"" + bat + "\"", CreateNoWindow = true }; Process.Start(info).WaitForExit(); foreach (var line in File.ReadLines(temp)) { Console.WriteLine(line); }
result: temp file contains requested data ... but it is FILE :(
attempt #4:
string temp = Path.GetTempFileName(); string bat = Path.ChangeExtension(temp, ".bat"); File.WriteAllLines(bat, new[] { @"call ""c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""","dumpbin.exe /exports \"" + dll + "\"" }); ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C \"" + bat + "\"", RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true }; var proc = Process.Start(info); proc.WaitForExit(); var data = proc.StandartOutput.ReadToEnd();
result: process proc never exits ...
attempt #5: no new ideas ... going here :) .... so my question is this:
Is there a way to accomplish this without generating temp files?
Cheers