我正在使用一个调用外部进程的 Visual Studio 2005 插件。
当我在插件之外运行代码时 - 即在独立项目中它工作正常。但是,当我将其作为插件的一部分调用时,会进行 Process.Start() 调用,但随后什么也没有发生,后续的代码行永远不会到达。
我曾尝试使用标准和提升的权限运行 VS,但效果相同。
代码如下 - 单击自定义菜单项时调用它:
string documentPath = @"C:\TestCode\TestApp\Testform.cs";
string folder = Path.GetDirectoryName(@"C:\TestCode\TestApp\");
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "notepad.exe";
p.StartInfo.Arguments = documentPath;
p.StartInfo.UseShellExecute = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string output = p.StandardOutput.ReadToEnd();
我尝试了不同的可执行文件,但这没有任何区别。我在VS中以错误的方式解决这个问题吗?任何帮助表示赞赏。