private static Process FindVsOrVsTestConsoleExe() { var process = Process.GetCurrentProcess(); string executable = Path.GetFileName(process.MainModule.FileName).Trim().ToLower(); while (executable != null && !ParentProcessRegex.IsMatch(executable)) { process = ParentProcessUtils.GetParentProcess(process.Id); executable = process != null ? Path.GetFileName(process.MainModule.FileName).Trim().ToLower() : null; } return(process); }
private static Process FindVsOrVsTestConsoleExe() { var process = Process.GetCurrentProcess(); string executable = Path.GetFileName(process.MainModule.FileName).Trim().ToUpperInvariant(); while (executable != null && executable != "DEVENV.EXE" && executable != "VSTEST.CONSOLE.EXE") { process = ParentProcessUtils.GetParentProcess(process.Id); executable = process != null ? Path.GetFileName(process.MainModule.FileName).Trim().ToUpperInvariant() : null; } return(process); }
private static string GetParentProcessName() { var parentProcess = ParentProcessUtils.GetParentProcess(Process.GetCurrentProcess()); return(parentProcess == null ? string.Empty : parentProcess.ProcessName); }