private static VsInstallation[] GetInstallations(List <string> args, TaskLoggingHelper log) { args.Add("-format"); args.Add("json"); var vswhere = GetVsWherePath(); var process = new Process { StartInfo = { FileName = vswhere, Arguments = ArgumentEscaper.EscapeAndConcatenate(args), RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true, } }; log.LogCommandLine(process.StartInfo.FileName + " " + process.StartInfo.Arguments); try { process.Start(); process.WaitForExit(); } catch (Exception ex) { log.LogError("vswhere failed." + ex.Message); return(Array.Empty <VsInstallation>()); } var output = process.StandardOutput.ReadToEnd(); if (process.ExitCode != 0) { log.LogMessage(MessageImportance.Low, "vswhere output = " + output); log.LogError("vswhere failed."); return(Array.Empty <VsInstallation>()); } return(JsonConvert.DeserializeObject <VsInstallation[]>(output)); }
public void LogCommandLine(string cmdLine) { log.LogCommandLine(cmdLine); }
public void Print(object message) { _msbuildLogger.LogCommandLine(MessageImportance.High, message.ToString()); }
void IOutputReceiver.LogDebugInfo(string info) { _loggingHelper.LogCommandLine(info); }