Enable detailed msbuild verbosity for user secrets (#19516)

This commit is contained in:
Brennan 2020-03-05 08:39:58 -08:00 committed by GitHub
parent 118ff3c40b
commit f910345469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 5 deletions

View File

@ -91,6 +91,8 @@ namespace Microsoft.Extensions.Tools.Internal
_output.WriteLine(_sb.ToString());
_sb.Clear();
}
_currentOutput.Append(value);
}
else
{

View File

@ -5,7 +5,7 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.Tools.Internal;
@ -53,26 +53,51 @@ namespace Microsoft.Extensions.SecretManager.Tools.Internal
"/p:Configuration=" + configuration,
"/p:CustomAfterMicrosoftCommonTargets=" + _targetsFile,
"/p:CustomAfterMicrosoftCommonCrossTargetingTargets=" + _targetsFile,
"-verbosity:detailed",
};
var psi = new ProcessStartInfo
{
FileName = DotNetMuxer.MuxerPathOrDefault(),
Arguments = ArgumentEscaper.EscapeAndConcatenate(args),
RedirectStandardOutput = true,
RedirectStandardError = true
RedirectStandardError = true,
UseShellExecute = false,
};
#if DEBUG
_reporter.Verbose($"Invoking '{psi.FileName} {psi.Arguments}'");
#endif
using var process = Process.Start(psi);
using var process = new Process()
{
StartInfo = psi,
};
var outputBuilder = new StringBuilder();
var errorBuilder = new StringBuilder();
process.OutputDataReceived += (_, d) =>
{
if (!string.IsNullOrEmpty(d.Data))
{
outputBuilder.AppendLine(d.Data);
}
};
process.ErrorDataReceived += (_, d) =>
{
if (!string.IsNullOrEmpty(d.Data))
{
errorBuilder.AppendLine(d.Data);
}
};
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
if (process.ExitCode != 0)
{
_reporter.Verbose(process.StandardOutput.ReadToEnd());
_reporter.Verbose(process.StandardError.ReadToEnd());
_reporter.Verbose(outputBuilder.ToString());
_reporter.Verbose(errorBuilder.ToString());
throw new InvalidOperationException(Resources.FormatError_ProjectFailedToLoad(projectFile));
}