Fixing our solution tests so that they go back to building the solution. Seems to work now, at least on OSX. Also, made a change to update solution to update any solutions in the folder where dotnet migrate is executed.
This commit is contained in:
parent
cb34818237
commit
85ec8a6f2c
9 changed files with 132 additions and 26 deletions
|
@ -8,12 +8,6 @@
|
||||||
<ProjectGuid>F8F96F4A-F10C-4C54-867C-A9EFF55494C8</ProjectGuid>
|
<ProjectGuid>F8F96F4A-F10C-4C54-867C-A9EFF55494C8</ProjectGuid>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="**\*.cs" />
|
|
||||||
<EmbeddedResource Include="**\*.resx" Exclude="@(EmbeddedResource)" />
|
|
||||||
<EmbeddedResource Include="compiler\resources\**\*" Exclude="@(EmbeddedResource)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NETStandard.Library">
|
<PackageReference Include="NETStandard.Library">
|
||||||
<Version>1.6.0</Version>
|
<Version>1.6.0</Version>
|
||||||
|
|
|
@ -2,9 +2,9 @@ using System;
|
||||||
|
|
||||||
namespace App.Tests
|
namespace App.Tests
|
||||||
{
|
{
|
||||||
public class Program
|
public class TestAssetProgram
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void TestAssetMain(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Hello World!");
|
Console.WriteLine("Hello World!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var projectDirectory in
|
foreach (var projectDirectory in
|
||||||
Enumerable.Repeat(directory, 1).Union(directory.GetDirectories()))
|
Enumerable.Repeat(directory, 1).Union(directory.GetDirectories("*", SearchOption.AllDirectories)))
|
||||||
{
|
{
|
||||||
AddIfProjectExists(projects, projectDirectory);
|
AddIfProjectExists(projects, projectDirectory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,15 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TestAssetInstance WithEmptyGlobalJson()
|
||||||
|
{
|
||||||
|
var file = Root.Parent.GetFile("global.json");
|
||||||
|
|
||||||
|
File.WriteAllText(file.FullName, @"{}");
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private void CopyFiles(IEnumerable<FileInfo> filesToCopy)
|
private void CopyFiles(IEnumerable<FileInfo> filesToCopy)
|
||||||
{
|
{
|
||||||
foreach (var file in filesToCopy)
|
foreach (var file in filesToCopy)
|
||||||
|
|
|
@ -103,7 +103,24 @@ namespace Microsoft.DotNet.Tools.Migrate
|
||||||
|
|
||||||
private void UpdateSolutionFile(MigrationReport migrationReport)
|
private void UpdateSolutionFile(MigrationReport migrationReport)
|
||||||
{
|
{
|
||||||
if (_slnFile == null)
|
if(_slnFile != null)
|
||||||
|
{
|
||||||
|
UpdateSolutionFile(migrationReport, _slnFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var slnPath in _workspaceDirectory.EnumerateFiles("*.sln"))
|
||||||
|
{
|
||||||
|
var slnFile = SlnFile.Read(slnPath.FullName);
|
||||||
|
|
||||||
|
UpdateSolutionFile(migrationReport, slnFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateSolutionFile(MigrationReport migrationReport, SlnFile slnFile)
|
||||||
|
{
|
||||||
|
if (slnFile == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Migrate
|
||||||
|
|
||||||
var csprojFilesToAdd = new HashSet<string>();
|
var csprojFilesToAdd = new HashSet<string>();
|
||||||
|
|
||||||
var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(_slnFile.BaseDirectory);
|
var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory);
|
||||||
foreach (var report in migrationReport.ProjectMigrationReports)
|
foreach (var report in migrationReport.ProjectMigrationReports)
|
||||||
{
|
{
|
||||||
var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
|
var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
|
||||||
|
@ -124,7 +141,7 @@ namespace Microsoft.DotNet.Tools.Migrate
|
||||||
reportPathWithTrailingSlash);
|
reportPathWithTrailingSlash);
|
||||||
|
|
||||||
var xprojPath = Path.Combine(relativeReportPath, report.ProjectName + ".xproj");
|
var xprojPath = Path.Combine(relativeReportPath, report.ProjectName + ".xproj");
|
||||||
var xprojProjectsReferencedBySolution = _slnFile.Projects.Where(p => p.FilePath == xprojPath);
|
var xprojProjectsReferencedBySolution = slnFile.Projects.Where(p => p.FilePath == xprojPath);
|
||||||
|
|
||||||
var migratedProjectName = report.ProjectName + ".csproj";
|
var migratedProjectName = report.ProjectName + ".csproj";
|
||||||
if (xprojProjectsReferencedBySolution.Count() == 1)
|
if (xprojProjectsReferencedBySolution.Count() == 1)
|
||||||
|
@ -138,7 +155,7 @@ namespace Microsoft.DotNet.Tools.Migrate
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var csprojPath = Path.Combine(relativeReportPath, migratedProjectName);
|
var csprojPath = Path.Combine(relativeReportPath, migratedProjectName);
|
||||||
var solutionContainsCsprojPriorToMigration = _slnFile.Projects
|
var solutionContainsCsprojPriorToMigration = slnFile.Projects
|
||||||
.Where(p => p.FilePath == csprojPath)
|
.Where(p => p.FilePath == csprojPath)
|
||||||
.Any();
|
.Any();
|
||||||
|
|
||||||
|
@ -155,20 +172,20 @@ namespace Microsoft.DotNet.Tools.Migrate
|
||||||
}
|
}
|
||||||
|
|
||||||
Version version;
|
Version version;
|
||||||
if (!Version.TryParse(_slnFile.VisualStudioVersion, out version) || version.Major < 15)
|
if (!Version.TryParse(slnFile.VisualStudioVersion, out version) || version.Major < 15)
|
||||||
{
|
{
|
||||||
_slnFile.ProductDescription = ProductDescription;
|
slnFile.ProductDescription = ProductDescription;
|
||||||
_slnFile.VisualStudioVersion = VisualStudioVersion;
|
slnFile.VisualStudioVersion = VisualStudioVersion;
|
||||||
_slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion;
|
slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveReferencesToMigratedFiles(_slnFile);
|
RemoveReferencesToMigratedFiles(slnFile);
|
||||||
|
|
||||||
_slnFile.Write();
|
slnFile.Write();
|
||||||
|
|
||||||
foreach (var csprojFile in csprojFilesToAdd)
|
foreach (var csprojFile in csprojFilesToAdd)
|
||||||
{
|
{
|
||||||
AddProject(_slnFile.FullPath, csprojFile);
|
AddProject(slnFile.FullPath, csprojFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
|
|
||||||
protected ProjectRootElement RunPackageDependenciesRuleOnPj(string s, string testDirectory = null)
|
protected ProjectRootElement RunPackageDependenciesRuleOnPj(string s, string testDirectory = null)
|
||||||
{
|
{
|
||||||
testDirectory = testDirectory ?? Temp.CreateDirectory().Path;
|
testDirectory =
|
||||||
|
testDirectory ??
|
||||||
|
Temp.CreateDirectory().DirectoryInfo.CreateSubdirectory("project").FullName;
|
||||||
return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[]
|
return TemporaryProjectFileRuleRunner.RunRules(new IMigrationRule[]
|
||||||
{
|
{
|
||||||
new MigratePackageDependenciesAndToolsRule()
|
new MigratePackageDependenciesAndToolsRule()
|
||||||
|
|
|
@ -3,7 +3,9 @@ using System.Linq;
|
||||||
using Microsoft.Build.Construction;
|
using Microsoft.Build.Construction;
|
||||||
using Microsoft.DotNet.ProjectJsonMigration.Rules;
|
using Microsoft.DotNet.ProjectJsonMigration.Rules;
|
||||||
using Microsoft.DotNet.Internal.ProjectModel;
|
using Microsoft.DotNet.Internal.ProjectModel;
|
||||||
|
using Microsoft.DotNet.TestFramework;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
{
|
{
|
||||||
|
@ -23,6 +25,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
string projectDirectory,
|
string projectDirectory,
|
||||||
string json)
|
string json)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var globalJson = Path.Combine(new DirectoryInfo(projectDirectory).Parent.FullName, "global.json");
|
||||||
|
if (!File.Exists(globalJson))
|
||||||
|
{
|
||||||
|
var file = new FileInfo(globalJson);
|
||||||
|
File.WriteAllText(file.FullName, @"{}");
|
||||||
|
}
|
||||||
|
|
||||||
var testPj = new ProjectJsonBuilder(null)
|
var testPj = new ProjectJsonBuilder(null)
|
||||||
.FromStringBase(json)
|
.FromStringBase(json)
|
||||||
.SaveToDisk(projectDirectory);
|
.SaveToDisk(projectDirectory);
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, projectName)
|
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, projectName)
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var solutionRelPath = "TestApp.sln";
|
var solutionRelPath = "TestApp.sln";
|
||||||
|
@ -58,6 +59,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndXprojRefs")
|
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndXprojRefs")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
||||||
|
@ -103,6 +105,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("NonRestoredTestProjects", "PJAppWithSlnAndOneAlreadyMigratedCsproj")
|
.GetProjectJson("NonRestoredTestProjects", "PJAppWithSlnAndOneAlreadyMigratedCsproj")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
||||||
|
@ -136,6 +139,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndOneAlreadyMigratedCsproj")
|
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndOneAlreadyMigratedCsproj")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
||||||
|
@ -184,12 +188,60 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ItMigratesSolutionInTheFolderWhenWeRunMigrationInThatFolder()
|
||||||
|
{
|
||||||
|
var projectDirectory = TestAssets
|
||||||
|
.Get("NonRestoredTestProjects", "PJAppWithSlnAndXprojRefs")
|
||||||
|
.CreateInstance()
|
||||||
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
|
.Root;
|
||||||
|
|
||||||
|
var workingDirectory = new DirectoryInfo(Path.Combine(projectDirectory.FullName, "TestApp"));
|
||||||
|
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
||||||
|
|
||||||
|
new DotnetCommand()
|
||||||
|
.WithWorkingDirectory(workingDirectory)
|
||||||
|
.Execute($"migrate")
|
||||||
|
.Should().Pass();
|
||||||
|
|
||||||
|
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));
|
||||||
|
|
||||||
|
var nonSolutionFolderProjects = slnFile.Projects
|
||||||
|
.Where(p => p.TypeGuid != ProjectTypeGuids.SolutionFolderGuid);
|
||||||
|
|
||||||
|
nonSolutionFolderProjects.Count().Should().Be(4);
|
||||||
|
|
||||||
|
var slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "TestApp").Single();
|
||||||
|
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
|
||||||
|
slnProject.FilePath.Should().Be("TestApp.csproj");
|
||||||
|
|
||||||
|
slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "TestLibrary").Single();
|
||||||
|
slnProject.TypeGuid.Should().Be(ProjectTypeGuids.CSharpProjectTypeGuid);
|
||||||
|
slnProject.FilePath.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
||||||
|
|
||||||
|
slnProject = nonSolutionFolderProjects.Where((p) => p.Name == "subdir").Single();
|
||||||
|
slnProject.FilePath.Should().Be(Path.Combine("src", "subdir", "subdir.csproj"));
|
||||||
|
|
||||||
|
new DotnetCommand()
|
||||||
|
.WithWorkingDirectory(projectDirectory)
|
||||||
|
.Execute($"restore \"{solutionRelPath}\"")
|
||||||
|
.Should().Pass();
|
||||||
|
|
||||||
|
new DotnetCommand()
|
||||||
|
.WithWorkingDirectory(projectDirectory)
|
||||||
|
.Execute($"build \"{solutionRelPath}\"")
|
||||||
|
.Should().Pass();
|
||||||
|
}
|
||||||
|
|
||||||
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
|
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
|
||||||
{
|
{
|
||||||
var projectDirectory = TestAssets
|
var projectDirectory = TestAssets
|
||||||
.Get(groupName, projectName)
|
.Get(groupName, projectName)
|
||||||
.CreateInstance(callingMethod: callingMethod, identifier: identifier)
|
.CreateInstance(callingMethod: callingMethod, identifier: identifier)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
|
||||||
|
@ -204,11 +256,10 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.Execute($"restore \"{solutionRelPath}\"")
|
.Execute($"restore \"{solutionRelPath}\"")
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
|
|
||||||
//ISSUE: https://github.com/dotnet/cli/issues/5205
|
new DotnetCommand()
|
||||||
//new DotnetCommand()
|
.WithWorkingDirectory(projectDirectory)
|
||||||
// .WithWorkingDirectory(projectDirectory)
|
.Execute($"build \"{solutionRelPath}\"")
|
||||||
// .Execute($"build \"{solutionRelPath}\"")
|
.Should().Pass();
|
||||||
// .Should().Pass();
|
|
||||||
|
|
||||||
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));
|
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
@ -68,6 +69,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
@ -87,6 +89,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
@ -115,6 +118,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("ProjectJsonConsoleTemplate")
|
.GetProjectJson("ProjectJsonConsoleTemplate")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var outputComparisonData = GetComparisonData(projectDirectory);
|
var outputComparisonData = GetComparisonData(projectDirectory);
|
||||||
|
@ -140,6 +144,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var globalDirectory = projectDirectory.Parent;
|
var globalDirectory = projectDirectory.Parent;
|
||||||
|
@ -168,6 +173,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson(projectName)
|
.GetProjectJson(projectName)
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
File.Copy("NuGet.tempaspnetpatch.config", projectDirectory.GetFile("NuGet.Config").FullName);
|
File.Copy("NuGet.tempaspnetpatch.config", projectDirectory.GetFile("NuGet.Config").FullName);
|
||||||
|
@ -185,6 +191,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("AppWithPackageNamedAfterFolder")
|
.GetProjectJson("AppWithPackageNamedAfterFolder")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var appProject = solutionDirectory
|
var appProject = solutionDirectory
|
||||||
|
@ -209,6 +216,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
MigrateProject(projectDirectory.GetDirectory(dependencyProject).FullName);
|
MigrateProject(projectDirectory.GetDirectory(dependencyProject).FullName);
|
||||||
|
@ -224,6 +232,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var globalDirectory = projectDirectory.Parent;
|
var globalDirectory = projectDirectory.Parent;
|
||||||
|
@ -245,6 +254,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);
|
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);
|
||||||
|
@ -270,6 +280,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);
|
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);
|
||||||
|
@ -296,6 +307,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(
|
var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(
|
||||||
|
@ -326,6 +338,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance(identifier: $"{projectName}.RefsTest")
|
.CreateInstance(identifier: $"{projectName}.RefsTest")
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName });
|
MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName });
|
||||||
|
@ -347,6 +360,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance($"{projectName}.SkipRefsTest")
|
.CreateInstance($"{projectName}.SkipRefsTest")
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName, "--skip-project-references" });
|
MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName, "--skip-project-references" });
|
||||||
|
@ -363,6 +377,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance(callingMethod: $"MigrateDirectory.SkipRefs.{skipRefs}")
|
.CreateInstance(callingMethod: $"MigrateDirectory.SkipRefs.{skipRefs}")
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
if (skipRefs)
|
if (skipRefs)
|
||||||
|
@ -386,6 +401,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var project = projectDirectory
|
var project = projectDirectory
|
||||||
|
@ -408,6 +424,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var projectDirectory = assetsDir.GetDirectory("ProjectF");
|
var projectDirectory = assetsDir.GetDirectory("ProjectF");
|
||||||
|
@ -443,6 +460,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance(identifier: projectNameSuffix)
|
.CreateInstance(identifier: projectNameSuffix)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var projectName = $"Project{projectNameSuffix}";
|
var projectName = $"Project{projectNameSuffix}";
|
||||||
|
@ -532,6 +550,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
@ -551,6 +570,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
CleanBinObj(projectDirectory);
|
CleanBinObj(projectDirectory);
|
||||||
|
@ -570,6 +590,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson("TestAppDependencyGraph")
|
.GetProjectJson("TestAppDependencyGraph")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var projectDirectory = solutionDirectory.GetDirectory(projectName);
|
var projectDirectory = solutionDirectory.GetDirectory(projectName);
|
||||||
|
@ -594,6 +615,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles()
|
.WithRestoreFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
var expectedCsprojPath = projectDirectory.GetFile($"{projectName}.csproj");
|
var expectedCsprojPath = projectDirectory.GetFile($"{projectName}.csproj");
|
||||||
|
@ -634,6 +656,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
.GetProjectJson(projectName)
|
.GetProjectJson(projectName)
|
||||||
.CreateInstance(identifier: projectName)
|
.CreateInstance(identifier: projectName)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
.WithEmptyGlobalJson()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
MigrateProject(projectDirectory.FullName);
|
MigrateProject(projectDirectory.FullName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue