From 357242f7b636d6b7dcca14cd87c5b826d26764e5 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sat, 17 Oct 2015 03:49:49 -0700 Subject: [PATCH] Print dependency diagnostics - Downgrade lock file validation changes to warning instead of an error - Don't show dependency information. Once we get log levels it'll be verbose. The response file can be used to debug things. --- .../Program.cs | 19 ++++++++++++++++++- .../ProjectContextBuilder.cs | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index d246f8eca..ba81143a2 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -73,6 +73,21 @@ namespace Microsoft.DotNet.Tools.Compiler // Create the library exporter var exporter = context.CreateExporter(configuration); + bool success = true; + + // Print out dependency diagnostics + foreach (var diag in context.LibraryManager.GetAllDiagnostics()) + { + success &= diag.Severity != DiagnosticMessageSeverity.Error; + Console.WriteLine(diag.FormattedMessage); + } + + // If there were dependency errors don't bother compiling + if (!success) + { + return false; + } + // Gather exports for the project var dependencies = exporter.GetCompilationDependencies().ToList(); @@ -96,7 +111,9 @@ namespace Microsoft.DotNet.Tools.Compiler } // Dump dependency data - ShowDependencyInfo(dependencies); + // TODO: Turn on only if verbose, we can look at the response + // file anyways + // ShowDependencyInfo(dependencies); // Hackily generate the output path if (string.IsNullOrEmpty(outputPath)) diff --git a/src/Microsoft.Extensions.ProjectModel/ProjectContextBuilder.cs b/src/Microsoft.Extensions.ProjectModel/ProjectContextBuilder.cs index 47b2c8392..af96137f9 100644 --- a/src/Microsoft.Extensions.ProjectModel/ProjectContextBuilder.cs +++ b/src/Microsoft.Extensions.ProjectModel/ProjectContextBuilder.cs @@ -121,7 +121,7 @@ namespace Microsoft.Extensions.ProjectModel ErrorCodes.NU1006, $"{lockFileValidationMessage}. Please run \"dnu restore\" to generate a new lock file.", Path.Combine(Project.ProjectDirectory, LockFile.FileName), - DiagnosticMessageSeverity.Error)); + DiagnosticMessageSeverity.Warning)); } }