diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln
index 0949bd419..2df65f361 100644
--- a/Microsoft.DotNet.Cli.sln
+++ b/Microsoft.DotNet.Cli.sln
@@ -11,11 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redist", "src\redist\redist
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EndToEnd.Tests", "test\EndToEnd\EndToEnd.Tests.csproj", "{1BFF54F9-4E35-49DB-893C-AF2047722FC6}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.Utilities", "test\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj", "{48E260F4-6F3F-4387-B61F-D15BABD06D9A}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core-sdk-tasks", "src\core-sdk-tasks\core-sdk-tasks.csproj", "{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.TestFramework", "test\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj", "{D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.Utilities", "test\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj", "{78E15EC1-7732-41E3-8591-934E9F583254}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -81,30 +79,6 @@ Global
{1BFF54F9-4E35-49DB-893C-AF2047722FC6}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{1BFF54F9-4E35-49DB-893C-AF2047722FC6}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{1BFF54F9-4E35-49DB-893C-AF2047722FC6}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|x64.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|x64.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|x86.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Debug|x86.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|x64.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|x64.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|x86.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.MinSizeRel|x86.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|Any CPU.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|x64.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|x64.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|x86.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.Release|x86.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -129,30 +103,30 @@ Global
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|x64.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|x64.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|x86.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Debug|x86.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|x64.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.MinSizeRel|x86.Build.0 = Debug|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|Any CPU.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|x64.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|x64.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|x86.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.Release|x86.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|x64.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Debug|x86.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|x64.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.MinSizeRel|x86.Build.0 = Debug|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|Any CPU.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|x64.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|x64.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|x86.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.Release|x86.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
+ {78E15EC1-7732-41E3-8591-934E9F583254}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -160,9 +134,8 @@ Global
GlobalSection(NestedProjects) = preSolution
{098D9321-1201-4974-A75E-F58EBCD98ACF} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{1BFF54F9-4E35-49DB-893C-AF2047722FC6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
- {48E260F4-6F3F-4387-B61F-D15BABD06D9A} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{53AF2D01-B69F-4CD0-86A7-8FD95967D23C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
- {D03CF1D2-39D1-4825-9AF0-4A4D3882CB69} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
+ {78E15EC1-7732-41E3-8591-934E9F583254} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B526D2CE-EE2D-4AD4-93EF-1867D90FF1F5}
diff --git a/TestAssets/Directory.Build.targets b/TestAssets/Directory.Build.targets
new file mode 100644
index 000000000..5cc7cd86a
--- /dev/null
+++ b/TestAssets/Directory.Build.targets
@@ -0,0 +1,3 @@
+
+
+
diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj
index 88edf2f41..dd392e365 100644
--- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj
+++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj
@@ -1,21 +1,16 @@
-
-
-
-
+
1.0.0-rc
- $(CliTargetFramework)
+ netcoreapp3.0
Exe
- $(MicrosoftNETCoreAppPackageVersion)
-
-
-
+
+
+
-
diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj
index f707001e8..dc66976a1 100644
--- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj
+++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj
@@ -1,8 +1,6 @@
-
-
-
+
- $(CliTargetFramework)
+ netcoreapp3.0
Exe
diff --git a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj
index c97da18f4..0ae5735e3 100644
--- a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj
+++ b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj
@@ -1,8 +1,6 @@
-
-
-
+
- $(CliTargetFramework)
+ netcoreapp3.0
Exe
diff --git a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj
index a095969a6..df18650a4 100644
--- a/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj
+++ b/TestAssets/TestProjects/MSBuildTestApp/MSBuildTestApp.csproj
@@ -1,10 +1,8 @@
-
Exe
- $(CliTargetFramework)
- win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;rhel.6-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64;linux-musl-x64
+ netcoreapp3.0
$(TEST_PACKAGES)
diff --git a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj
index d05c83d53..6a4dd2c22 100644
--- a/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj
+++ b/TestAssets/TestProjects/TestAppWithProjDepTool/TestAppWithProjDepTool.csproj
@@ -1,9 +1,8 @@
-
Exe
- $(CliTargetFramework)
+ netcoreapp3.0
$(TEST_PACKAGES)
diff --git a/test/EndToEnd/EndToEnd.Tests.csproj b/test/EndToEnd/EndToEnd.Tests.csproj
index 020070444..fb4f7ed82 100644
--- a/test/EndToEnd/EndToEnd.Tests.csproj
+++ b/test/EndToEnd/EndToEnd.Tests.csproj
@@ -4,14 +4,10 @@
-
-
-
-
-
+
+
+
+
@@ -19,4 +15,8 @@
-->
+
+
+
+
diff --git a/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs b/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs
index f8b781be6..f9be29af0 100644
--- a/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs
+++ b/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs
@@ -175,30 +175,29 @@ namespace EndToEnd
[Fact(Skip = "https://github.com/dotnet/core-sdk/issues/21")]
public void WeCoverLatestAspNetCoreAppRollForward()
{
+ var directory = TestAssets.CreateTestDirectory();
+ string projectDirectory = directory.FullName;
+
// Run "dotnet new web", get TargetFramework property, and make sure it's covered in SupportedAspNetCoreAppVersions
- using (DisposableDirectory directory = Temp.CreateDirectory())
- {
- string projectDirectory = directory.Path;
- new NewCommandShim()
- .WithWorkingDirectory(projectDirectory)
- .Execute("web --no-restore")
- .Should().Pass();
+ new NewCommandShim()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute("web --no-restore")
+ .Should().Pass();
- string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
+ string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
- var project = XDocument.Load(projectPath);
- var ns = project.Root.Name.Namespace;
+ var project = XDocument.Load(projectPath);
+ var ns = project.Root.Name.Namespace;
- string targetFramework = project.Root.Element(ns + "PropertyGroup")
- .Element(ns + "TargetFramework")
- .Value;
+ string targetFramework = project.Root.Element(ns + "PropertyGroup")
+ .Element(ns + "TargetFramework")
+ .Value;
- SupportedAspNetCoreAppVersions.Select(v => $"netcoreapp{v[0]}")
- .Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreAppVersions)} property should include the default version " +
- "of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
+ SupportedAspNetCoreAppVersions.Select(v => $"netcoreapp{v[0]}")
+ .Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreAppVersions)} property should include the default version " +
+ "of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
- }
}
private NuGetVersion GetAspNetCoreAppVersion(LockFile lockFile, bool portable = false)
diff --git a/test/EndToEnd/GivenDotNetUsesMSBuild.cs b/test/EndToEnd/GivenDotNetUsesMSBuild.cs
index 474bcf14c..fe2446da8 100644
--- a/test/EndToEnd/GivenDotNetUsesMSBuild.cs
+++ b/test/EndToEnd/GivenDotNetUsesMSBuild.cs
@@ -5,6 +5,7 @@ using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
+using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
@@ -14,50 +15,61 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{
public class GivenDotNetUsesMSBuild : TestBase
{
+ private string _testPackagesDirectory;
+ private string _testNuGetCache;
+
+ public GivenDotNetUsesMSBuild()
+ {
+ _testPackagesDirectory = SetupTestPackages();
+
+ _testNuGetCache = TestAssets.CreateTestDirectory(testProjectName: string.Empty,
+ callingMethod: "packages",
+ identifier: string.Empty)
+ .FullName;
+ }
+
[Fact]
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
{
- using (DisposableDirectory directory = Temp.CreateDirectory())
- {
- string projectDirectory = directory.Path;
+ var directory = TestAssets.CreateTestDirectory();
+ string projectDirectory = directory.FullName;
+
+ string newArgs = "console --debug:ephemeral-hive --no-restore";
+ new NewCommandShim()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute(newArgs)
+ .Should().Pass();
- string newArgs = "console --debug:ephemeral-hive --no-restore";
- new NewCommandShim()
- .WithWorkingDirectory(projectDirectory)
- .Execute(newArgs)
- .Should().Pass();
+ new RestoreCommand()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute("/p:SkipInvalidConfigurations=true")
+ .Should().Pass();
- new RestoreCommand()
- .WithWorkingDirectory(projectDirectory)
- .Execute("/p:SkipInvalidConfigurations=true")
- .Should().Pass();
+ new BuildCommand()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute()
+ .Should().Pass();
- new BuildCommand()
- .WithWorkingDirectory(projectDirectory)
- .Execute()
- .Should().Pass();
+ var runCommand = new RunCommand()
+ .WithWorkingDirectory(projectDirectory);
- var runCommand = new RunCommand()
- .WithWorkingDirectory(projectDirectory);
+ // Set DOTNET_ROOT as workaround for https://github.com/dotnet/cli/issues/10196
+ runCommand = runCommand.WithEnvironmentVariable(Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)",
+ Path.GetDirectoryName(DotnetUnderTest.FullName));
- // Set DOTNET_ROOT as workaround for https://github.com/dotnet/cli/issues/10196
- runCommand = runCommand.WithEnvironmentVariable(Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)",
- Path.GetDirectoryName(DotnetUnderTest.FullName));
+ runCommand.ExecuteWithCapturedOutput()
+ .Should().Pass()
+ .And.HaveStdOutContaining("Hello World!");
- runCommand.ExecuteWithCapturedOutput()
- .Should().Pass()
- .And.HaveStdOutContaining("Hello World!");
+ var binDirectory = new DirectoryInfo(projectDirectory).Sub("bin");
+ binDirectory.Should().HaveFilesMatching("*.dll", SearchOption.AllDirectories);
- var binDirectory = new DirectoryInfo(projectDirectory).Sub("bin");
- binDirectory.Should().HaveFilesMatching("*.dll", SearchOption.AllDirectories);
+ new CleanCommand()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute()
+ .Should().Pass();
- new CleanCommand()
- .WithWorkingDirectory(projectDirectory)
- .Execute()
- .Should().Pass();
-
- binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
- }
+ binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
}
[Fact]
@@ -65,13 +77,22 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{
var testInstance = TestAssets.Get("MSBuildTestApp")
.CreateInstance()
- .WithSourceFiles()
- .WithRestoreFiles();
+ .WithSourceFiles();
var testProjectDirectory = testInstance.Root;
+ new RestoreCommand()
+ .WithWorkingDirectory(testProjectDirectory)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
+ .Execute()
+ .Should()
+ .Pass();
+
new DotnetCommand()
.WithWorkingDirectory(testInstance.Root)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
.ExecuteWithCapturedOutput("-d portable")
.Should()
.Pass()
@@ -79,49 +100,133 @@ namespace Microsoft.DotNet.Tests.EndToEnd
.HaveStdOutContaining("Hello Portable World!");;
}
- [Fact(Skip="https://github.com/dotnet/cli/issues/9688")]
+ [Fact]
public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresADifferentRuntime()
{
var testInstance = TestAssets.Get("MSBuildTestApp")
.CreateInstance()
- .WithSourceFiles()
- .WithRestoreFiles();
+ .WithSourceFiles();
var testProjectDirectory = testInstance.Root;
+ new RestoreCommand()
+ .WithWorkingDirectory(testProjectDirectory)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
+ .Execute()
+ .Should()
+ .Pass();
+
+
new DotnetCommand()
.WithWorkingDirectory(testInstance.Root)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
.ExecuteWithCapturedOutput("-d prefercliruntime")
.Should().Pass()
.And.HaveStdOutContaining("Hello I prefer the cli runtime World!");;
}
- [Fact(Skip="https://github.com/dotnet/cli/issues/9688")]
+ [Fact]
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
{
var repoDirectoriesProvider = new RepoDirectoriesProvider();
var testInstance = TestAssets.Get("TestAppWithProjDepTool")
.CreateInstance()
- .WithSourceFiles()
- .WithRestoreFiles();
+ .WithSourceFiles();
var configuration = "Debug";
var testProjectDirectory = testInstance.Root;
+ new RestoreCommand()
+ .WithWorkingDirectory(testProjectDirectory)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
+ .Execute()
+ .Should()
+ .Pass();
+
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
.Execute($"-c {configuration} ")
.Should()
.Pass();
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
+ .WithEnvironmentVariable("NUGET_PACKAGES", _testNuGetCache)
+ .WithEnvironmentVariable("TEST_PACKAGES", _testPackagesDirectory)
.ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp3.0 portable")
.Should().Pass()
- .And.HaveStdOutContaining("Hello Portable World!");;
+ .And.HaveStdOutContaining("Hello Portable World!");
+ }
+
+ [Fact]
+ public void BuildTestPackages()
+ {
+
+ }
+
+ private string SetupTestPackages()
+ {
+ var directory = TestAssets.CreateTestDirectory(
+ testProjectName: string.Empty,
+ callingMethod: "TestPackages",
+ identifier: string.Empty);
+
+ string testPackagesDirectory = Path.Combine(directory.FullName, "testPackages");
+
+ if (!Directory.Exists(testPackagesDirectory))
+ {
+ new DirectoryInfo(testPackagesDirectory).Create();
+ //Directory.CreateDirectory(testPackagesDirectory);
+ }
+
+ var testPackageNames = new[]
+ {
+ "dotnet-portable",
+ "dotnet-prefercliruntime",
+ "dotnet-dependency-tool-invoker"
+ };
+
+ foreach (var testPackageName in testPackageNames)
+ {
+
+
+ var assetInfo = TestAssets.Get(TestAssetKinds.TestPackages, testPackageName);
+
+ var testProjectDirectory = new DirectoryInfo(Path.Combine(directory.FullName, testPackageName));
+
+ if (!testProjectDirectory.Exists)
+ {
+ testProjectDirectory.Create();
+ }
+
+ var testInstance = new TestAssetInstance(assetInfo, testProjectDirectory)
+ .WithSourceFiles()
+ .WithRestoreFiles();
+
+ new PackCommand()
+ .WithWorkingDirectory(testProjectDirectory)
+ .Execute()
+ .Should()
+ .Pass();
+
+ string nupkgFilePathInOutput = Directory.GetFiles(Path.Combine(testProjectDirectory.FullName, "bin", "Debug"), "*.nupkg")
+ .Single();
+
+ string nupkgFile = Path.Combine(testPackagesDirectory, Path.GetFileName(nupkgFilePathInOutput));
+
+ File.Copy(nupkgFilePathInOutput, nupkgFile);
+
+ }
+
+ return testPackagesDirectory;
}
}
}
diff --git a/test/EndToEnd/GivenFrameworkDependentApps.cs b/test/EndToEnd/GivenFrameworkDependentApps.cs
index 59717a5a1..56e590f3e 100644
--- a/test/EndToEnd/GivenFrameworkDependentApps.cs
+++ b/test/EndToEnd/GivenFrameworkDependentApps.cs
@@ -40,8 +40,6 @@ namespace EndToEnd
{
var _testInstance = TestAssets.Get("TestAppSimple")
.CreateInstance(identifier: packageName + "_" + minorVersion)
- // scope the feed to only dotnet-core feed to avoid flaky when different feed has a newer / lower version
- .WithNuGetConfig(new RepoDirectoriesProvider().TestPackages)
.WithSourceFiles();
string projectDirectory = _testInstance.Root.FullName;
diff --git a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs
index 800f05a22..5b8e0524d 100644
--- a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs
+++ b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs
@@ -141,57 +141,55 @@ namespace EndToEnd
public void WeCoverLatestNetCoreAppRollForward()
{
// Run "dotnet new console", get TargetFramework property, and make sure it's covered in SupportedNetCoreAppVersions
- using (DisposableDirectory directory = Temp.CreateDirectory())
- {
- string projectDirectory = directory.Path;
+ var directory = TestAssets.CreateTestDirectory();
+ string projectDirectory = directory.FullName;
- new NewCommandShim()
- .WithWorkingDirectory(projectDirectory)
- .Execute("console --no-restore")
- .Should().Pass();
+ new NewCommandShim()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute("console --no-restore")
+ .Should().Pass();
- string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
+ string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
- var project = XDocument.Load(projectPath);
- var ns = project.Root.Name.Namespace;
+ var project = XDocument.Load(projectPath);
+ var ns = project.Root.Name.Namespace;
- string targetFramework = project.Root.Element(ns + "PropertyGroup")
- .Element(ns + "TargetFramework")
- .Value;
+ string targetFramework = project.Root.Element(ns + "PropertyGroup")
+ .Element(ns + "TargetFramework")
+ .Value;
- SupportedNetCoreAppVersions.Versions.Select(v => $"netcoreapp{v}")
- .Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)}.{nameof(SupportedNetCoreAppVersions.Versions)} property should include the default version " +
- "of .NET Core created by \"dotnet new\"");
- }
+ SupportedNetCoreAppVersions.Versions.Select(v => $"netcoreapp{v}")
+ .Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)}.{nameof(SupportedNetCoreAppVersions.Versions)} property should include the default version " +
+ "of .NET Core created by \"dotnet new\"");
}
[Fact]
public void WeCoverLatestAspNetCoreAppRollForward()
{
+ var directory = TestAssets.CreateTestDirectory();
+ string projectDirectory = directory.FullName;
+
// Run "dotnet new web", get TargetFramework property, and make sure it's covered in SupportedAspNetCoreAppVersions
- using (DisposableDirectory directory = Temp.CreateDirectory())
- {
- string projectDirectory = directory.Path;
- new NewCommandShim()
- .WithWorkingDirectory(projectDirectory)
- .Execute("web --no-restore")
- .Should().Pass();
+ new NewCommandShim()
+ .WithWorkingDirectory(projectDirectory)
+ .Execute("web --no-restore")
+ .Should().Pass();
- string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
+ string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
- var project = XDocument.Load(projectPath);
- var ns = project.Root.Name.Namespace;
+ var project = XDocument.Load(projectPath);
+ var ns = project.Root.Name.Namespace;
- string targetFramework = project.Root.Element(ns + "PropertyGroup")
- .Element(ns + "TargetFramework")
- .Value;
+ string targetFramework = project.Root.Element(ns + "PropertyGroup")
+ .Element(ns + "TargetFramework")
+ .Value;
- SupportedAspNetCoreVersions.Versions.Select(v => $"netcoreapp{v}")
- .Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreVersions)} should include the default version " +
- "of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
+ SupportedAspNetCoreVersions.Versions.Select(v => $"netcoreapp{v}")
+ .Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreVersions)} should include the default version " +
+ "of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
- }
+
}
}
diff --git a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj b/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj
deleted file mode 100644
index cb7af1643..000000000
--- a/test/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- netstandard2.0
-
-
- $(RepoRoot)eng\Key.snk
-
-
- Custom
- 0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb
- adb9793829ddae60
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/Microsoft.DotNet.TestFramework/Properties/AssemblyInfo.cs b/test/Microsoft.DotNet.TestFramework/Properties/AssemblyInfo.cs
deleted file mode 100644
index 110018e7f..000000000
--- a/test/Microsoft.DotNet.TestFramework/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-// 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.Reflection;
-
-[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
index b8f3ca9cc..03ee56d6c 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
@@ -238,9 +238,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
psi.Environment[item.Key] = item.Value;
#endif
}
-
- // Flow the TEST_PACKAGES environment variable to the child process
- psi.Environment["TEST_PACKAGES"] = System.Environment.GetEnvironmentVariable("TEST_PACKAGES");
}
private void AddWorkingDirectoryTo(ProcessStartInfo psi)
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs
index d02eedae1..b4af40ae3 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs
@@ -25,16 +25,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
}
}
- public static string WithBackwardsCompatibleRuntimes
- {
- get
- {
- return Path.Combine(
- new RepoDirectoriesProvider().Stage2WithBackwardsCompatibleRuntimesDirectory,
- "dotnet");
- }
- }
-
public static bool IsLocalized()
{
for (var culture = CultureInfo.CurrentUICulture; !culture.Equals(CultureInfo.InvariantCulture); culture = culture.Parent)
diff --git a/test/Microsoft.DotNet.TestFramework/Extensions/DirectoryInfoExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs
similarity index 100%
rename from test/Microsoft.DotNet.TestFramework/Extensions/DirectoryInfoExtensions.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/Extensions/DirectoryInfoExtensions.cs
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj
index 328a40e9a..866245523 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Microsoft.DotNet.Tools.Tests.Utilities.csproj
@@ -3,10 +3,6 @@
netstandard2.0
-
-
-
-
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs
index de2af4896..27f704575 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/RepoDirectoriesProvider.cs
@@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Xml.Linq;
using Microsoft.DotNet.PlatformAbstractions;
@@ -11,128 +12,54 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class RepoDirectoriesProvider
{
- private static string s_repoRoot;
- private static string s_buildRid;
+ public readonly static string RepoRoot;
+
+ public readonly static string TestWorkingFolder;
+ public readonly static string DotnetUnderTest;
- private string _artifacts;
- private string _dotnetRoot;
- private string _builtDotnet;
- private string _nugetPackages;
- private string _stage2Sdk;
- private string _stage2WithBackwardsCompatibleRuntimesDirectory;
- private string _testPackages;
- private string _testWorkingFolder;
- private string _testArtifactsFolder;
-
- public static string RepoRoot
+ static RepoDirectoriesProvider()
{
- get
- {
- if (!string.IsNullOrEmpty(s_repoRoot))
- {
- return s_repoRoot;
- }
#if NET451
- string directory = AppDomain.CurrentDomain.BaseDirectory;
+ string directory = AppDomain.CurrentDomain.BaseDirectory;
#else
- string directory = AppContext.BaseDirectory;
+ string directory = AppContext.BaseDirectory;
#endif
- while (directory != null)
- {
- var gitDirOrFile = Path.Combine(directory, ".git");
- if (Directory.Exists(gitDirOrFile) || File.Exists(gitDirOrFile))
- {
- break;
- }
- directory = Directory.GetParent(directory)?.FullName;
- }
-
- if (directory == null)
- {
- throw new Exception("Cannot find the git repository root");
- }
-
- s_repoRoot = directory;
- return s_repoRoot;
- }
- }
-
- public static string BuildRid
- {
- get
+ while (directory != null)
{
- if (string.IsNullOrEmpty(s_buildRid))
+ var gitDirOrFile = Path.Combine(directory, ".git");
+ if (Directory.Exists(gitDirOrFile) || File.Exists(gitDirOrFile))
{
- var buildInfoPath = Path.Combine(RepoRoot, "bin", "obj", "BuildInfo.props");
- var root = XDocument.Load(buildInfoPath).Root;
- var ns = root.Name.Namespace;
-
- s_buildRid = root
- .Elements(ns + "PropertyGroup")
- .Elements(ns + "Rid")
- .FirstOrDefault()
- ?.Value;
-
- if (string.IsNullOrEmpty(s_buildRid))
- {
- throw new InvalidOperationException($"Could not find a property named 'Rid' in {buildInfoPath}");
- }
+ break;
}
-
- return s_buildRid;
+ directory = Directory.GetParent(directory)?.FullName;
}
- }
- public string Artifacts => _artifacts;
- public string BuiltDotnet => _builtDotnet;
- public string DotnetRoot => _dotnetRoot;
- public string NugetPackages => _nugetPackages;
- public string Stage2Sdk => _stage2Sdk;
- public string Stage2WithBackwardsCompatibleRuntimesDirectory => _stage2WithBackwardsCompatibleRuntimesDirectory;
- public string TestPackages => _testPackages;
- public string TestWorkingFolder => _testWorkingFolder;
- public string TestArtifactsFolder => _testArtifactsFolder;
+ RepoRoot = directory;
- public RepoDirectoriesProvider(
- string artifacts = null,
- string builtDotnet = null,
- string nugetPackages = null,
- string corehostPackages = null,
- string corehostDummyPackages = null)
- {
- // Ideally this wouldn't be hardcoded, so that you could use stage n to build stage n + 1, and then use stage n + 1 to run tests
- int previousStage = 2;
-
- _artifacts = artifacts ?? Path.Combine(RepoRoot,
- "bin",
- previousStage.ToString(),
- BuildRid);
- _builtDotnet = builtDotnet ?? Path.Combine(_artifacts, "intermediate", "sharedFrameworkPublish");
- _dotnetRoot = Path.Combine(_artifacts, "dotnet");
- _nugetPackages = nugetPackages ?? Path.Combine(RepoRoot, ".nuget", "packages");
- _stage2Sdk = Directory
- .EnumerateDirectories(Path.Combine(_artifacts, "dotnet", "sdk"))
- .First(d => !d.Contains("NuGetFallbackFolder"));
-
- _stage2WithBackwardsCompatibleRuntimesDirectory =
- Path.Combine(_artifacts, "dotnetWithBackwardsCompatibleRuntimes");
-
- _testPackages = Environment.GetEnvironmentVariable("TEST_PACKAGES");
- if (string.IsNullOrEmpty(_testPackages))
+ TestWorkingFolder = Environment.GetEnvironmentVariable("CORESDK_TEST_FOLDER");
+ if (string.IsNullOrEmpty(TestWorkingFolder))
{
- _testPackages = Path.Combine(_artifacts, "test", "packages");
+ TestWorkingFolder = Path.Combine(AppContext.BaseDirectory, "Tests");
}
- _testArtifactsFolder = Path.Combine(_artifacts, "test", "artifacts");
-
- _testWorkingFolder = Path.Combine(RepoRoot,
- "bin",
- (previousStage + 1).ToString(),
- BuildRid,
- "test");
-
+ DotnetUnderTest = Environment.GetEnvironmentVariable("DOTNET_UNDER_TEST");
+ string dotnetExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "";
+ if (string.IsNullOrEmpty(DotnetUnderTest))
+ {
+ if (RepoRoot == null)
+ {
+ DotnetUnderTest = "dotnet" + dotnetExtension;
+ }
+ else
+ {
+ string configuration = new DirectoryInfo(AppContext.BaseDirectory).Parent.Name;
+ // TODO: Don't put in framework-specific folder (so we don't need to sync TFM here)
+ DotnetUnderTest = Path.Combine(RepoRoot, "artifacts", "bin", "redist", configuration, "netcoreapp3.0", "publish", "dotnet" + dotnetExtension);
+ }
+ }
}
+
}
}
diff --git a/test/Microsoft.DotNet.TestFramework/TestAssetInfo.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs
similarity index 100%
rename from test/Microsoft.DotNet.TestFramework/TestAssetInfo.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInfo.cs
diff --git a/test/Microsoft.DotNet.TestFramework/TestAssetInstance.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs
similarity index 88%
rename from test/Microsoft.DotNet.TestFramework/TestAssetInstance.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs
index 93509a21a..9702e6a40 100644
--- a/test/Microsoft.DotNet.TestFramework/TestAssetInstance.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstance.cs
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
using System.Xml.Linq;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Common;
+using Microsoft.DotNet.Tools.Test.Utilities;
namespace Microsoft.DotNet.TestFramework
{
@@ -29,8 +30,6 @@ namespace Microsoft.DotNet.TestFramework
private bool _built = false;
- public static string CurrentRuntimeFrameworkVersion = new Muxer().SharedFxVersion;
-
public TestAssetInstance(TestAssetInfo testAssetInfo, DirectoryInfo root)
{
if (testAssetInfo == null)
@@ -171,23 +170,6 @@ namespace Microsoft.DotNet.TestFramework
return this;
}
- public TestAssetInstance UseCurrentRuntimeFrameworkVersion()
- {
- return WithProjectChanges(project =>
- {
- var ns = project.Root.Name.Namespace;
-
- var propertyGroup = project.Root.Elements(ns + "PropertyGroup").LastOrDefault();
- if (propertyGroup == null)
- {
- propertyGroup = new XElement(ns + "PropertyGroup");
- project.Root.Add(propertyGroup);
- }
-
- propertyGroup.Add(new XElement(ns + "RuntimeFrameworkVersion", CurrentRuntimeFrameworkVersion));
- });
- }
-
private static string RebasePath(string path, string oldBaseDirectory, string newBaseDirectory)
{
path = Path.IsPathRooted(path) ? PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(oldBaseDirectory), path) : path;
@@ -285,18 +267,7 @@ namespace Microsoft.DotNet.TestFramework
.CaptureStdErr()
.Execute();
- int exitCode = commandResult.ExitCode;
-
- if (exitCode != 0)
- {
- Console.WriteLine(commandResult.StdOut);
-
- Console.WriteLine(commandResult.StdErr);
-
- string message = string.Format($"TestAsset Restore '{TestAssetInfo.AssetName}'@'{projectFile.FullName}' Failed with {exitCode}");
-
- throw new Exception(message);
- }
+ commandResult.Should().Pass();
}
private void RestoreAllProjects()
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstanceExtensions.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstanceExtensions.cs
deleted file mode 100644
index a1cf95916..000000000
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInstanceExtensions.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml.Linq;
-using Microsoft.DotNet.Cli.Utils;
-using Microsoft.DotNet.TestFramework;
-using Microsoft.DotNet.Tools.Common;
-
-namespace Microsoft.DotNet.Tools.Test.Utilities
-{
- public static class TestAssetInstanceExtensions
- {
- public static TestAssetInstance WithNuGetConfigAndExternalRestoreSources(
- this TestAssetInstance testAssetInstance, string nugetCache)
- {
- var externalRestoreSourcesForTests = Path.Combine(
- new RepoDirectoriesProvider().TestArtifactsFolder, "ExternalRestoreSourcesForTestsContainer.txt");
- var externalRestoreSources = File.Exists(externalRestoreSourcesForTests) ?
- File.ReadAllText(externalRestoreSourcesForTests) :
- string.Empty;
-
- return testAssetInstance.WithNuGetConfig(nugetCache, externalRestoreSources);
- }
- }
-}
\ No newline at end of file
diff --git a/test/Microsoft.DotNet.TestFramework/TestAssetInventoryFiles.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs
similarity index 100%
rename from test/Microsoft.DotNet.TestFramework/TestAssetInventoryFiles.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetInventoryFiles.cs
diff --git a/test/Microsoft.DotNet.TestFramework/TestAssetKinds.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs
similarity index 91%
rename from test/Microsoft.DotNet.TestFramework/TestAssetKinds.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs
index 216c92c51..80835f2bb 100644
--- a/test/Microsoft.DotNet.TestFramework/TestAssetKinds.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssetKinds.cs
@@ -18,5 +18,7 @@ namespace Microsoft.DotNet.TestFramework
public static string TestProjects = "TestProjects";
public static string NonRestoredTestProjects = "NonRestoredTestProjects";
+
+ public static string TestPackages = "TestPackages";
}
}
diff --git a/test/Microsoft.DotNet.TestFramework/TestAssets.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs
similarity index 88%
rename from test/Microsoft.DotNet.TestFramework/TestAssets.cs
rename to test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs
index 6d05788fd..8b66b6ac5 100644
--- a/test/Microsoft.DotNet.TestFramework/TestAssets.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestAssets.cs
@@ -64,7 +64,7 @@ namespace Microsoft.DotNet.TestFramework
this);
}
- public DirectoryInfo CreateTestDirectory(string testProjectName = "temp", [CallerMemberName] string callingMethod = "", string identifier = "")
+ public DirectoryInfo CreateTestDirectory(string testProjectName = "", [CallerMemberName] string callingMethod = "", string identifier = "")
{
var testDestination = GetTestDestinationDirectoryPath(testProjectName, callingMethod, identifier);
@@ -85,7 +85,12 @@ namespace Microsoft.DotNet.TestFramework
// Find the name of the assembly the test comes from based on the the base directory and how the output path has been constructed
string testAssemblyName = new DirectoryInfo(baseDirectory).Parent.Parent.Name;
- return Path.Combine(_testWorkingFolder, testAssemblyName, callingMethod + identifier, testProjectName);
+ string directory = Path.Combine(_testWorkingFolder, testAssemblyName, callingMethod + identifier);
+ if (!string.IsNullOrEmpty(testProjectName))
+ {
+ directory = Path.Combine(directory, testProjectName);
+ }
+ return directory;
}
}
}
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs
index 6c2c43346..b2a8dcb29 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs
@@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
s_testAssets = new TestAssets(
new DirectoryInfo(assetsRoot),
new FileInfo(new Muxer().MuxerPath),
- new RepoDirectoriesProvider().TestWorkingFolder);
+ RepoDirectoriesProvider.TestWorkingFolder);
}
return s_testAssets;