diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs index d2a7fe48f..05a1d06dc 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/ProjectMigrator.cs @@ -92,12 +92,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration var defaultProjectContext = projectContexts.First(); - if (defaultProjectContext.LockFile == null) - { - MigrationErrorCodes.MIGRATE1012( - $"project.lock.json not found in {projectDirectory}, please run dotnet restore before doing migration").Throw(); - } - var diagnostics = defaultProjectContext.ProjectFile.Diagnostics; if (diagnostics.Any()) { diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs index d053751fb..a651283aa 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/GivenAProjectMigrator.cs @@ -19,7 +19,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests public void It_copies_ProjectDirectory_contents_to_OutputDirectory_when_the_directories_are_different() { var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestAppSimple", callingMethod: "z") - .WithLockFiles().Path; + .Path; var outputDirectory = Temp.CreateDirectory().Path; var projectDirectoryRelativeFilePaths = EnumerateFilesWithRelativePath(testProjectDirectory); @@ -41,7 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests { var testProjectDirectory = TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z") - .WithLockFiles().Path; + .Path; var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj); @@ -60,7 +60,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests { var testProjectDirectory = TestAssetsManager.CreateTestInstance("FSharpTestProjects/TestApp", callingMethod: "z") - .WithLockFiles().Path; + .Path; var mockProj = ProjectRootElement.Create(); var testSettings = new MigrationSettings(testProjectDirectory, testProjectDirectory, "1.0.0", mockProj); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs index 2986c72b3..175aeb7e5 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateProjectDependencies.cs @@ -22,7 +22,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests public void If_a_project_dependency_is_present_DesignTimeAutoUnify_and_AutoUnify_are_present() { var solutionDirectory = - TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: "p").WithLockFiles().Path; + TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: "p").Path; var appDirectory = Path.Combine(solutionDirectory, "TestApp"); var libDirectory = Path.Combine(solutionDirectory, "TestLibrary"); diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs index 9ce2606eb..df4a78048 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateRuntimeOptions.cs @@ -25,7 +25,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests [Fact] public void RuntimeOptions_are_copied_from_projectJson_to_runtimeconfig_template_json_file() { - var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithRuntimeOptions").WithLockFiles(); + var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithRuntimeOptions"); var projectDir = testInstance.Path; var projectPath = Path.Combine(testInstance.Path, "project.json"); @@ -49,7 +49,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests [Fact] public void Migrating_ProjectJson_with_no_RuntimeOptions_produces_no_runtimeconfig_template_json_file() { - var testInstance = TestAssetsManager.CreateTestInstance("TestAppSimple").WithLockFiles(); + var testInstance = TestAssetsManager.CreateTestInstance("TestAppSimple"); var projectDir = testInstance.Path; var projectContext = ProjectContext.Create(projectDir, FrameworkConstants.CommonFrameworks.NetCoreApp10); diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 645e4cb0f..7ea3a3cfb 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -142,6 +142,9 @@ namespace Microsoft.DotNet.Migration.Tests var projectJsonBuildOutputs = new HashSet(CollectBuildOutputs(projectDirectory)); CleanBinObj(projectDirectory); + // Remove lock file for migration + File.Delete(Path.Combine(projectDirectory, "project.lock.json")); + MigrateProject(projectDirectory); Restore(projectDirectory); BuildMSBuild(projectDirectory);