Pass nologo to MSBuild in 'add package' command

Fixes #6534
This commit is contained in:
Mikkel Nylander Bundgaard 2017-05-12 22:23:47 +02:00
parent 7f50f322d5
commit 05b0b64e55
2 changed files with 24 additions and 0 deletions

View file

@ -100,6 +100,9 @@ namespace Microsoft.DotNet.Tools.Add.PackageReference
// Turn off restore for Dotnet cli tool references so that we do not generate extra dg specs
args.Add($"/p:RestoreDotnetCliToolReferences=false");
// Output should not include MSBuild version header
args.Add("/nologo");
var result = new MSBuildForwardingApp(args).Execute();
if (result != 0)

View file

@ -116,6 +116,27 @@ namespace Microsoft.DotNet.Cli.Package.Add.Tests
cmd.StdErr.Should().BeEmpty();
}
[Fact]
public void WhenValidPackageIsPassedMSBuildDoesNotPrintVersionHeader()
{
var testAsset = "TestAppSimple";
var projectDirectory = TestAssets
.Get(testAsset)
.CreateInstance()
.WithSourceFiles()
.Root
.FullName;
var packageName = "Newtonsoft.Json";
var packageVersion = "9.0.1";
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"add package {packageName} --version {packageVersion}");
cmd.Should().Pass();
cmd.StdOut.Should().NotContain("Microsoft (R) Build Engine version");
cmd.StdErr.Should().BeEmpty();
}
[Fact]
public void WhenMultiplePackagesArePassedCommandFails()
{