![Livar Cunha](/assets/img/avatar_default.png)
* 'master' of /Users/livarcocc/Documents/git/cli: (1063 commits) Updating signing project to use new intermediate directory (int). Update runtimeconfig.json doc for 2.1 (#9382) Shortening the path to the intermediate folder by renaming it to int. fix typo (#9364) Updating asp.net to 2.2.0 as well. Updating the build and tests to work with the 2.2.0 runtime. Simplified combining dictionaries in Telemetry Fixing 'Channel' and 'BranchName': "release/2.1.4xx" to "master" (#9362) Fix extraction of folders (#9335) Update Sha256Hasher.cs Fix relative path tool path (#9330) Insert updated SDK from 2.1.4xx branch MSBuild 15.8.60 Fix crash when user home directory cannot be determined. Make `CliFolderPathCalculator` a static class. Don't add the ReleaseSuffix to the branding on the CLI when DropSuffix is set to true. Add retry when Directory.Move (#9313) Override new SdkResult public properties Add reference to Microsoft.Build.NuGetSdkResolver Disable crossgen for MSBuild inline-task refs ...
120 lines
4.4 KiB
C#
120 lines
4.4 KiB
C#
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System;
|
|
using System.IO;
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
using Xunit;
|
|
|
|
[assembly: CollectionBehavior(DisableTestParallelization = true)]
|
|
|
|
namespace Microsoft.DotNet.Tests.EndToEnd
|
|
{
|
|
public class GivenDotNetUsesMSBuild : TestBase
|
|
{
|
|
[Fact]
|
|
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
|
|
{
|
|
using (DisposableDirectory directory = Temp.CreateDirectory())
|
|
{
|
|
string projectDirectory = directory.Path;
|
|
|
|
string newArgs = "console -f netcoreapp2.1 --debug:ephemeral-hive --no-restore";
|
|
new NewCommandShim()
|
|
.WithWorkingDirectory(projectDirectory)
|
|
.Execute(newArgs)
|
|
.Should().Pass();
|
|
|
|
new RestoreCommand()
|
|
.WithWorkingDirectory(projectDirectory)
|
|
.Execute("/p:SkipInvalidConfigurations=true")
|
|
.Should().Pass();
|
|
|
|
new BuildCommand()
|
|
.WithWorkingDirectory(projectDirectory)
|
|
.Execute()
|
|
.Should().Pass();
|
|
|
|
new RunCommand()
|
|
.WithWorkingDirectory(projectDirectory)
|
|
.ExecuteWithCapturedOutput()
|
|
.Should().Pass()
|
|
.And.HaveStdOutContaining("Hello World!");
|
|
|
|
var binDirectory = new DirectoryInfo(projectDirectory).Sub("bin");
|
|
binDirectory.Should().HaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
|
|
|
new CleanCommand()
|
|
.WithWorkingDirectory(projectDirectory)
|
|
.Execute()
|
|
.Should().Pass();
|
|
|
|
binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void ItCanRunToolsInACSProj()
|
|
{
|
|
var testInstance = TestAssets.Get("MSBuildTestApp")
|
|
.CreateInstance()
|
|
.WithSourceFiles()
|
|
.WithRestoreFiles();
|
|
|
|
var testProjectDirectory = testInstance.Root;
|
|
|
|
new DotnetCommand()
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
.ExecuteWithCapturedOutput("portable")
|
|
.Should()
|
|
.Pass()
|
|
.And
|
|
.HaveStdOutContaining("Hello Portable World!");;
|
|
}
|
|
|
|
[Fact]
|
|
public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresADifferentRuntime()
|
|
{
|
|
var testInstance = TestAssets.Get("MSBuildTestApp")
|
|
.CreateInstance()
|
|
.WithSourceFiles()
|
|
.WithRestoreFiles();
|
|
|
|
var testProjectDirectory = testInstance.Root;
|
|
|
|
new DotnetCommand()
|
|
.WithWorkingDirectory(testInstance.Root)
|
|
.ExecuteWithCapturedOutput("prefercliruntime")
|
|
.Should().Pass()
|
|
.And.HaveStdOutContaining("Hello I prefer the cli runtime World!");;
|
|
}
|
|
|
|
[Fact]
|
|
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
|
|
{
|
|
var repoDirectoriesProvider = new RepoDirectoriesProvider();
|
|
|
|
var testInstance = TestAssets.Get("TestAppWithProjDepTool")
|
|
.CreateInstance()
|
|
.WithSourceFiles()
|
|
.WithRestoreFiles();
|
|
|
|
var configuration = "Debug";
|
|
|
|
var testProjectDirectory = testInstance.Root;
|
|
|
|
new BuildCommand()
|
|
.WithWorkingDirectory(testProjectDirectory)
|
|
.Execute($"-c {configuration} ")
|
|
.Should()
|
|
.Pass();
|
|
|
|
new DotnetCommand()
|
|
.WithWorkingDirectory(testProjectDirectory)
|
|
.ExecuteWithCapturedOutput(
|
|
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp2.2 portable")
|
|
.Should().Pass()
|
|
.And.HaveStdOutContaining("Hello Portable World!");;
|
|
}
|
|
}
|
|
}
|