Moving the project dependencies construction to after we check for the skip project reference check, so that we really don't look for P2P projects when the flag is passed.
This commit is contained in:
parent
b312fbb176
commit
e1f355065d
2 changed files with 21 additions and 8 deletions
|
@ -37,12 +37,20 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
// Try to read the project dependencies, ignore an unresolved exception for now
|
||||
MigrationRuleInputs rootInputs = ComputeMigrationRuleInputs(rootSettings);
|
||||
IEnumerable<ProjectDependency> projectDependencies = null;
|
||||
var projectMigrationReports = new List<ProjectMigrationReport>();
|
||||
|
||||
try
|
||||
{
|
||||
// Verify up front so we can prefer these errors over an unresolved project dependency
|
||||
VerifyInputs(rootInputs, rootSettings);
|
||||
|
||||
projectMigrationReports.Add(MigrateProject(rootSettings));
|
||||
|
||||
if (skipProjectReferences)
|
||||
{
|
||||
return new MigrationReport(projectMigrationReports);
|
||||
}
|
||||
|
||||
projectDependencies = ResolveTransitiveClosureProjectDependencies(
|
||||
rootSettings.ProjectDirectory,
|
||||
rootSettings.ProjectXProjFilePath,
|
||||
|
@ -61,14 +69,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
});
|
||||
}
|
||||
|
||||
var projectMigrationReports = new List<ProjectMigrationReport>();
|
||||
projectMigrationReports.Add(MigrateProject(rootSettings));
|
||||
|
||||
if (skipProjectReferences)
|
||||
{
|
||||
return new MigrationReport(projectMigrationReports);
|
||||
}
|
||||
|
||||
foreach(var project in projectDependencies)
|
||||
{
|
||||
var projectDir = Path.GetDirectoryName(project.ProjectFilePath);
|
||||
|
|
|
@ -163,6 +163,19 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
PublishMSBuild(projectDirectory, projectName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItMigratesAProjectThatDependsOnAMigratedProjectWithTheSkipProjectReferenceFlag()
|
||||
{
|
||||
const string dependentProject = "ProjectA";
|
||||
const string dependencyProject = "ProjectB";
|
||||
|
||||
var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppDependencyGraph").Path;
|
||||
|
||||
MigrateProject(Path.Combine(projectDirectory, dependencyProject));
|
||||
|
||||
MigrateProject("--skip-project-references", Path.Combine(projectDirectory, dependentProject));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItAddsMicrosoftNetWebSdkToTheSdkAttributeOfAWebApp()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue