diff --git a/src/dotnet/commands/dotnet-build/Program.cs b/src/dotnet/commands/dotnet-build/Program.cs index 714f8bbbd..64fb721e8 100644 --- a/src/dotnet/commands/dotnet-build/Program.cs +++ b/src/dotnet/commands/dotnet-build/Program.cs @@ -89,6 +89,8 @@ namespace Microsoft.DotNet.Tools.Build msbuildArgs.Add($"/verbosity:{verbosityOption.Value()}"); } + msbuildArgs.Add($"/clp:Summary"); + msbuildArgs.AddRange(app.RemainingArguments); return new MSBuildForwardingApp(msbuildArgs).Execute(); diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs index 3589be785..1bb59fc4d 100644 --- a/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs +++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs @@ -72,5 +72,25 @@ namespace Microsoft.DotNet.Cli.Build.Tests .Should().Pass() .And.HaveStdOutContaining("Hello World"); } + + [Fact] + public void ItPrintsBuildSummary() + { + var testAppName = "MSBuildTestApp"; + var testInstance = TestAssets.Get(testAppName) + .CreateInstance(testAppName) + .WithSourceFiles() + .WithRestoreFiles(); + + string expectedBuildSummary = @"Build succeeded. + 0 Warning(s) + 0 Error(s)"; + + var cmd = new BuildCommand() + .WithWorkingDirectory(testInstance.Root) + .ExecuteWithCapturedOutput(); + cmd.Should().Pass(); + cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary); + } } } diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs index 08fdfca37..17ee1299a 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateSolutions.cs @@ -7,6 +7,7 @@ using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Tools.Test.Utilities; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using Xunit; namespace Microsoft.DotNet.Migration.Tests @@ -37,11 +38,11 @@ namespace Microsoft.DotNet.Migration.Tests "PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj"); } - private void MigrateAndBuild(string groupName, string projectName) + private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "") { var projectDirectory = TestAssets .Get(groupName, projectName) - .CreateInstance() + .CreateInstance(callingMethod: callingMethod, identifier: identifier) .WithSourceFiles() .Root;