diff --git a/TestAssets/TestProjects/ProjectJsonWebTemplate/project.json.template b/TestAssets/TestProjects/ProjectJsonWebTemplate/project.json similarity index 100% rename from TestAssets/TestProjects/ProjectJsonWebTemplate/project.json.template rename to TestAssets/TestProjects/ProjectJsonWebTemplate/project.json diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 188e79700..31e80dcb1 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -11,6 +11,8 @@ using Microsoft.DotNet.Tools.Migrate; using Build3Command = Microsoft.DotNet.Tools.Test.Utilities.Build3Command; using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand; using System.Runtime.Loader; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Microsoft.DotNet.Migration.Tests { @@ -90,14 +92,23 @@ namespace Microsoft.DotNet.Migration.Tests VerifyAllMSBuildOutputsRunnable(projectDirectory); } - [Fact(Skip="https://github.com/dotnet/cli/issues/4299")] - public void It_migrates_dotnet_new_web_with_outputs_containing_project_json_outputs() + [Fact] + public void It_migrates_old_dotnet_new_web_without_tools_with_outputs_containing_project_json_outputs() { var testInstance = TestAssetsManager - .CreateTestInstance("ProjectJsonWebTemplate"); + .CreateTestInstance("ProjectJsonWebTemplate") + .WithLockFiles(); var projectDirectory = testInstance.Path; + var globalDirectory = Path.Combine(projectDirectory, ".."); + var projectJsonFile = Path.Combine(projectDirectory, "project.json"); + + WriteGlobalJson(globalDirectory); + var projectJson = JObject.Parse(File.ReadAllText(projectJsonFile)); + projectJson.Remove("tools"); + File.WriteAllText(projectJsonFile, projectJson.ToString()); + var outputComparisonData = GetComparisonData(projectDirectory); var outputsIdentical = @@ -591,5 +602,14 @@ namespace Microsoft.DotNet.Migration.Tests MSBuildBuildOutputs = msBuildBuildOutputs; } } + + private void WriteGlobalJson(string globalDirectory) + { + var file = Path.Combine(globalDirectory, "global.json"); + File.WriteAllText(file, @" + { + ""projects"": [ ] + }"); + } } }