From 9f4d43c29544b3a3f38bad7a6c354cd561f061e5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 30 Aug 2017 22:46:25 +0100 Subject: [PATCH] Make build output clearer (log info, don't pack irrelevant project) --- src/Directory.Build.props | 1 - .../DependencyUpdater.csproj | 1 + .../SubstituteProjectFileVariables.cs | 20 +++++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e5054e52fc..631e9f3fbe 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,6 @@ - true False False False diff --git a/tools/DependencyUpdater/DependencyUpdater.csproj b/tools/DependencyUpdater/DependencyUpdater.csproj index 745210816a..0beb5f36be 100644 --- a/tools/DependencyUpdater/DependencyUpdater.csproj +++ b/tools/DependencyUpdater/DependencyUpdater.csproj @@ -2,6 +2,7 @@ netstandard2.0 Library + false diff --git a/tools/DependencyUpdater/SubstituteProjectFileVariables.cs b/tools/DependencyUpdater/SubstituteProjectFileVariables.cs index 4d5368a466..72d9ba6232 100644 --- a/tools/DependencyUpdater/SubstituteProjectFileVariables.cs +++ b/tools/DependencyUpdater/SubstituteProjectFileVariables.cs @@ -1,4 +1,5 @@ -using Microsoft.Build.Utilities; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; using System; using System.Collections.Generic; using System.IO; @@ -28,15 +29,30 @@ namespace DependencyUpdater // to the output location and then modify the copy. var outFile = Path.Combine(OutDir, Path.GetFileName(NupkgFile)); File.Copy(NupkgFile, outFile, true); - + + var numProjectFiles = 0; using (var zipFile = ZipFile.Open(outFile, ZipArchiveMode.Update)) { foreach (var projectFile in zipFile.Entries.Where(IsProjectFile)) { + numProjectFiles++; PerformVariableSubstitutions(projectFile, substitutionsDict); } } + if (numProjectFiles == 0) + { + Log.LogMessage( + MessageImportance.High, + $"No project files found in {Path.GetFileName(outFile)}, so no variables substituted."); + } + else + { + Log.LogMessage( + MessageImportance.High, + $"Substituted variables in {numProjectFiles} project file(s) in {Path.GetFileName(outFile)}"); + } + return true; }