diff --git a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs index ee0adaa14031..cae95a0ae500 100644 --- a/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs +++ b/src/Tests/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs @@ -7,6 +7,7 @@ using Microsoft.DotNet.Tools.Test.Utilities; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; using Xunit; using Xunit.Abstractions; diff --git a/src/Tests/Microsoft.NET.Build.Tests/COMReferenceTests.cs b/src/Tests/Microsoft.NET.Build.Tests/COMReferenceTests.cs index 7e61b6162e81..2a4df8ae4840 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/COMReferenceTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/COMReferenceTests.cs @@ -81,7 +81,7 @@ class MediaPlayerClass { } buildCommand.Execute().Should().Pass(); var outputDirectory = buildCommand.GetOutputDirectory(targetFramework); - var runCommand = new RunExeCommand(Log, outputDirectory.File("UseMediaPlayer.exe").FullName); + var runCommand = new RunExeCommand(Log, outputDirectory.GetFile("UseMediaPlayer.exe").FullName); runCommand.Execute().Should().Pass(); } } diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantRuntimeConfigInBuiltProjectOutputGroup.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantRuntimeConfigInBuiltProjectOutputGroup.cs index 62efc816b784..d8af631a4a86 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantRuntimeConfigInBuiltProjectOutputGroup.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantRuntimeConfigInBuiltProjectOutputGroup.cs @@ -45,7 +45,7 @@ public void It_has_target_path_and_final_outputput_path_metadata(string targetFr command.Execute().Should().Pass(); var outputDirectory = command.GetOutputDirectory(targetFramework); - var runtimeConfigFile = outputDirectory.File("HelloWorld.runtimeconfig.json"); + var runtimeConfigFile = outputDirectory.GetFile("HelloWorld.runtimeconfig.json"); var (_, metadata) = command.GetValuesWithMetadata().Single(i => i.value == runtimeConfigFile.FullName); metadata.Count.Should().Be(2); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithSharedProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithSharedProject.cs index 79e3dcb19a24..d8ba9edbac0a 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithSharedProject.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithSharedProject.cs @@ -9,6 +9,7 @@ using Xunit.Abstractions; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; using System.IO; using System.Linq; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToPreserveCompilationContextForBuild.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToPreserveCompilationContextForBuild.cs index bcbd3db09438..ed651954f9f1 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToPreserveCompilationContextForBuild.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToPreserveCompilationContextForBuild.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyModel; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; using Microsoft.NET.TestFramework.ProjectConstruction; using Xunit; diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseVB.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseVB.cs index ab83ec68525a..01e3f01ff6b6 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseVB.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseVB.cs @@ -97,7 +97,7 @@ End Module var outputDirectory = buildCommand.GetOutputDirectory(targetFramework); var actualVBRuntime = GetVBRuntime(buildCommand.GetValues().FirstOrDefault()); - File.Delete(outputDirectory.File("VBRuntimeValues.txt").FullName); + File.Delete(outputDirectory.GetFile("VBRuntimeValues.txt").FullName); outputDirectory.Should().OnlyHaveFiles(expectedOutputFiles); actualVBRuntime.Should().Be(expectedVBRuntime); diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToVerifyNuGetReferenceCompat.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToVerifyNuGetReferenceCompat.cs index d42c940cca8c..f0e2d71ab59b 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToVerifyNuGetReferenceCompat.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToVerifyNuGetReferenceCompat.cs @@ -205,7 +205,7 @@ public void It_chooses_lowest_netfx_in_default_atf() var buildCommand = new BuildCommand(testProjectTestAsset); buildCommand.Execute().Should().Pass(); - var referencedDll = buildCommand.GetOutputDirectory("netcoreapp3.0").File("net462_net472_pkg.dll").FullName; + var referencedDll = buildCommand.GetOutputDirectory("netcoreapp3.0").GetFile("net462_net472_pkg.dll").FullName; var referencedTargetFramework = AssemblyInfo.Get(referencedDll)["TargetFrameworkAttribute"]; referencedTargetFramework.Should().Be(".NETFramework,Version=v4.6.2"); } diff --git a/src/Tests/Microsoft.NET.Build.Tests/KnownRuntimePackTests.cs b/src/Tests/Microsoft.NET.Build.Tests/KnownRuntimePackTests.cs index 5274a61a38da..e50e56c0a9eb 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/KnownRuntimePackTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/KnownRuntimePackTests.cs @@ -4,6 +4,7 @@ using FluentAssertions; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; using Microsoft.NET.TestFramework.ProjectConstruction; using Xunit; diff --git a/src/Tests/Microsoft.NET.Build.Tests/NonCopyLocalProjectReferenceTests.cs b/src/Tests/Microsoft.NET.Build.Tests/NonCopyLocalProjectReferenceTests.cs index 66b5255cbee8..d7f5a9a67dc9 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/NonCopyLocalProjectReferenceTests.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/NonCopyLocalProjectReferenceTests.cs @@ -58,7 +58,7 @@ public void NonCopyLocalProjectReferenceDoesNotGoToDeps() var outputDirectory = buildCommand.GetOutputDirectory(targetFramework); - using var stream = File.OpenRead(outputDirectory.File("MainProject.deps.json").FullName); + using var stream = File.OpenRead(outputDirectory.GetFile("MainProject.deps.json").FullName); using var reader = new DependencyContextJsonReader(); reader diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProjectWithPackagedShim.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProjectWithPackagedShim.cs index 723600fd1d9a..26a125fda2b5 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProjectWithPackagedShim.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAToolProjectWithPackagedShim.cs @@ -6,6 +6,7 @@ using System.Linq; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; using FluentAssertions; using Xunit; diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index ac965c450d5b..5c7a82ae0dc7 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -610,7 +610,7 @@ class Program var publishDir = publishCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: rid); publishDir.Should().HaveFile("System.IO.Compression.ZipFile.dll"); - GivenThatWeWantToPublishReadyToRun.DoesImageHaveR2RInfo(publishDir.File("TestWeb.Views.dll").FullName); + GivenThatWeWantToPublishReadyToRun.DoesImageHaveR2RInfo(publishDir.GetFile("TestWeb.Views.dll").FullName); } private static bool DoesImageHaveMethod(string path, string methodNameToCheck) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs index 60e07f2784fe..4a8699587540 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs @@ -14,6 +14,7 @@ using Microsoft.NET.TestFramework.Assertions; using Microsoft.NET.TestFramework.Commands; using Microsoft.NET.TestFramework.ProjectConstruction; +using Microsoft.NET.TestFramework.Utilities; using NuGet.Packaging.Core; using NuGet.Versioning; diff --git a/src/Tests/Microsoft.NET.TestFramework/Assertions/DirectoryInfoExtensions.cs b/src/Tests/Microsoft.NET.TestFramework/Assertions/DirectoryInfoExtensions.cs index fc86116858a7..94fa3fa8e0ee 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Assertions/DirectoryInfoExtensions.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Assertions/DirectoryInfoExtensions.cs @@ -15,15 +15,5 @@ public static DirectoryInfoAssertions Should(this DirectoryInfo dir) { return new DirectoryInfoAssertions(dir); } - - public static DirectoryInfo Sub(this DirectoryInfo dir, string name) - { - return new DirectoryInfo(Path.Combine(dir.FullName, name)); - } - - public static FileInfo File(this DirectoryInfo dir, string name) - { - return new FileInfo(Path.Combine(dir.FullName, name)); - } } } diff --git a/src/Tests/Microsoft.NET.TestFramework/Assertions/FileInfoExtensions.cs b/src/Tests/Microsoft.NET.TestFramework/Assertions/FileInfoExtensions.cs index 140351fab1f9..4d344aebfa4d 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Assertions/FileInfoExtensions.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Assertions/FileInfoExtensions.cs @@ -25,10 +25,5 @@ public static IDisposable NuGetLock(this FileInfo subject) { return new FileInfoNuGetLock(subject); } - - public static string ReadAllText(this FileInfo subject) - { - return File.ReadAllText(subject.FullName); - } } } diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/ComposeStoreCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/ComposeStoreCommand.cs index 1a7619baf8b6..a85f6fdd9a93 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/ComposeStoreCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/ComposeStoreCommand.cs @@ -3,10 +3,11 @@ #if NETCOREAPP -using Microsoft.DotNet.Cli.Utils; using System.IO; using System.Runtime.InteropServices; using Xunit.Abstractions; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.NET.TestFramework.Utilities; namespace Microsoft.NET.TestFramework.Commands { @@ -20,24 +21,23 @@ public ComposeStoreCommand(ITestOutputHelper log, string projectPath, string rel } public override DirectoryInfo GetOutputDirectory(string targetFramework = "netcoreapp1.0", string configuration = "Debug", string runtimeIdentifier = "") - { - string output = Path.Combine(ProjectRootPath, "bin", BuildRelativeOutputPath(targetFramework, configuration, runtimeIdentifier)); - return new DirectoryInfo(output); - } - - public string GetPublishedAppPath(string appName) - { - return Path.Combine(GetOutputDirectory().FullName, $"{appName}.dll"); - } - - private string BuildRelativeOutputPath(string targetFramework, string configuration, string runtimeIdentifier) { if (runtimeIdentifier.Length == 0) { runtimeIdentifier = RuntimeInformation.RuntimeIdentifier; } string arch = runtimeIdentifier.Substring(runtimeIdentifier.LastIndexOf("-") + 1); - return Path.Combine(configuration, arch, targetFramework, PublishSubfolderName); + string relativeToBaseOutputPath = Path.Combine(configuration, arch, targetFramework, runtimeIdentifier, PublishSubfolderName); + return base.GetBaseOutputDirectory().Sub(relativeToBaseOutputPath); + + // TODO: SDK-Style projects must not contain arch in the platform. Replace the above logic with the following once it's fixed. + // DirectoryInfo baseDirectory = base.GetBaseOutputDirectory(targetFramework, configuration, runtimeIdentifier); + // return baseDirectory.Sub(PublishSubfolderName); + } + + public string GetPublishedAppPath(string appName) + { + return Path.Combine(GetOutputDirectory().FullName, $"{appName}.dll"); } } } diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs index eb1101e92e89..ad66bdbb6e30 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/GetValuesCommand.cs @@ -5,7 +5,7 @@ using System.Linq; using System.IO; using FluentAssertions; -using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Xunit.Abstractions; namespace Microsoft.NET.TestFramework.Commands @@ -68,10 +68,9 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args) newArgs.AddRange(args); // Override build target to write out DefineConstants value to a file in the output directory - Directory.CreateDirectory(GetBaseIntermediateDirectory().FullName); - string injectTargetPath = Path.Combine( - GetBaseIntermediateDirectory().FullName, - Path.GetFileName(ProjectFile) + ".WriteValuesToFile.g.targets"); + DirectoryInfo objDir = GetBaseIntermediateDirectory(); + if (!objDir.Exists) objDir.Create(); + FileInfo injectTargetsFile = objDir.GetFile($"{Path.GetFileName(ProjectFile)}.WriteValuesToFile.g.targets"); string linesAttribute; if (_valueType == ValueType.Property) @@ -115,7 +114,7 @@ protected override SdkCommandSpec CreateCommand(IEnumerable args) "; injectTargetContents = injectTargetContents.Replace('`', '"'); - File.WriteAllText(injectTargetPath, injectTargetContents); + File.WriteAllText(injectTargetsFile.FullName, injectTargetContents); var outputDirectory = GetOutputDirectory(_targetFramework); outputDirectory.Create(); diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs index f7bd715e74a3..820573184261 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/MSBuildCommand.cs @@ -13,7 +13,7 @@ namespace Microsoft.NET.TestFramework.Commands { public class MSBuildCommand : TestCommand - { + { public string Target { get; } private readonly string _projectRootPath; @@ -72,38 +72,53 @@ internal static string FindProjectFile(ref string projectRootPath, string relati return buildProjectFiles[0]; } - public virtual DirectoryInfo GetOutputDirectory(string targetFramework, string configuration = "Debug", string runtimeIdentifier = "") + private DirectoryInfo GetDirectoryRelativeToProjectRoot(params string[] dirs) + { + string relativePath = Path.Combine(dirs); + string output = Path.Combine(ProjectRootPath, relativePath); + return new DirectoryInfo(output); + } + + public virtual DirectoryInfo GetBaseOutputDirectory() + { + return GetDirectoryRelativeToProjectRoot("bin"); + } + + public virtual DirectoryInfo GetBaseIntermediateDirectory() + { + return GetDirectoryRelativeToProjectRoot("obj"); + } + + public virtual DirectoryInfo GetNonSDKOutputDirectory(string configuration = "Debug") { - targetFramework = targetFramework ?? string.Empty; configuration = configuration ?? string.Empty; - runtimeIdentifier = runtimeIdentifier ?? string.Empty; - string output = Path.Combine(ProjectRootPath, "bin", configuration, targetFramework, runtimeIdentifier); - return new DirectoryInfo(output); + return GetDirectoryRelativeToProjectRoot("bin", configuration); } - public virtual DirectoryInfo GetIntermediateDirectory(string targetFramework, string configuration = "Debug", string runtimeIdentifier = "") + public virtual DirectoryInfo GetNonSDKIntermediateDirectory(string configuration = "Debug") { - targetFramework = targetFramework ?? string.Empty; configuration = configuration ?? string.Empty; - runtimeIdentifier = runtimeIdentifier ?? string.Empty; - string output = Path.Combine(ProjectRootPath, "obj", configuration, targetFramework, runtimeIdentifier); - return new DirectoryInfo(output); + return GetDirectoryRelativeToProjectRoot("obj", configuration); } - public virtual DirectoryInfo GetNonSDKOutputDirectory(string configuration = "Debug") + public virtual DirectoryInfo GetOutputDirectory(string targetFramework, string configuration = "Debug", string runtimeIdentifier = "") { + targetFramework = targetFramework ?? string.Empty; configuration = configuration ?? string.Empty; + runtimeIdentifier = runtimeIdentifier ?? string.Empty; - string output = Path.Combine(ProjectRootPath, "bin", configuration); - return new DirectoryInfo(output); + return GetDirectoryRelativeToProjectRoot("bin", configuration, targetFramework, runtimeIdentifier); } - public DirectoryInfo GetBaseIntermediateDirectory() + public virtual DirectoryInfo GetIntermediateDirectory(string targetFramework, string configuration = "Debug", string runtimeIdentifier = "") { - string output = Path.Combine(ProjectRootPath, "obj"); - return new DirectoryInfo(output); + targetFramework = targetFramework ?? string.Empty; + configuration = configuration ?? string.Empty; + runtimeIdentifier = runtimeIdentifier ?? string.Empty; + + return GetDirectoryRelativeToProjectRoot("obj", configuration, targetFramework, runtimeIdentifier); } protected virtual bool ExecuteWithRestoreByDefault => true; diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/PackCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/PackCommand.cs index 47078b78ba6c..cce2bb030f3f 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/PackCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/PackCommand.cs @@ -33,7 +33,7 @@ public string GetNuGetPackage(string packageId = null, string configuration = "D packageId = Path.GetFileNameWithoutExtension(ProjectFile); } - return Path.Combine(GetOutputDirectory(null, configuration).FullName, $"{packageId}.{packageVersion}.nupkg"); + return Path.Combine(GetBaseOutputDirectory().FullName, configuration, $"{packageId}.{packageVersion}.nupkg"); } } } diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs index 20c09f520e6e..066cefbd88f9 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; +using Microsoft.NET.TestFramework.Utilities; using Xunit.Abstractions; namespace Microsoft.NET.TestFramework.Commands @@ -17,8 +18,8 @@ public PublishCommand(ITestOutputHelper log, string projectPath) public override DirectoryInfo GetOutputDirectory(string targetFramework = "netcoreapp1.1", string configuration = "Debug", string runtimeIdentifier = "") { - DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); - return new DirectoryInfo(Path.Combine(baseDirectory.FullName, PublishSubfolderName)); + DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); + return baseDirectory.Sub(PublishSubfolderName); } public string GetPublishedAppPath(string appName) diff --git a/src/Tests/Microsoft.NET.TestFramework/Utilities/CommonExtensions.cs b/src/Tests/Microsoft.NET.TestFramework/Utilities/CommonExtensions.cs new file mode 100644 index 000000000000..20dfdb4ee00d --- /dev/null +++ b/src/Tests/Microsoft.NET.TestFramework/Utilities/CommonExtensions.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.NET.TestFramework.Utilities +{ + public static class CommonExtensions + { + public static DirectoryInfo Sub(this DirectoryInfo dir, string name) + { + return new DirectoryInfo(Path.Combine(dir.FullName, name)); + } + + public static FileInfo GetFile(this DirectoryInfo dir, string name) + { + return new FileInfo(Path.Combine(dir.FullName, name)); + } + + public static string ReadAllText(this FileInfo subject) + { + return File.ReadAllText(subject.FullName); + } + } +} diff --git a/src/Tests/dotnet.Tests/PackagedCommandTests.cs b/src/Tests/dotnet.Tests/PackagedCommandTests.cs index d4ac55b8ad20..b8d474b43b47 100644 --- a/src/Tests/dotnet.Tests/PackagedCommandTests.cs +++ b/src/Tests/dotnet.Tests/PackagedCommandTests.cs @@ -18,6 +18,7 @@ using System.Xml.Linq; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Utilities; using Microsoft.NET.TestFramework.Commands; namespace Microsoft.DotNet.Tests @@ -190,10 +191,10 @@ public void ItRunsToolRestoredToSpecificPackageDir() string randomPackageName = Guid.NewGuid().ToString().Substring(24); // TODO: This is a workaround for https://github.com/dotnet/cli/issues/5020 - SetGeneratedPackageName(appWithDepOnToolDir.File("AppWithDepOnTool.csproj"), + SetGeneratedPackageName(appWithDepOnToolDir.GetFile("AppWithDepOnTool.csproj"), randomPackageName); - SetGeneratedPackageName(toolWithRandPkgNameDir.File("ToolWithRandomPackageName.csproj"), + SetGeneratedPackageName(toolWithRandPkgNameDir.GetFile("ToolWithRandomPackageName.csproj"), randomPackageName);