Skip to content

Commit

Permalink
Use project name in project path map to account for multi-targeting (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat authored Dec 20, 2024
1 parent bfa1bbc commit 2f99a87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public async Task UpdateProjectConeAsync(string rootProjectPath, CancellationTok
projectInfos = [];
}

var oldProjectIdsByPath = oldSolution.Projects.ToDictionary(keySelector: static p => p.FilePath!, elementSelector: static p => p.Id);
var oldProjectIdsByPath = oldSolution.Projects.ToDictionary(keySelector: static p => (p.FilePath!, p.Name), elementSelector: static p => p.Id);

// Map new project id to the corresponding old one based on file path, if it exists, and null for added projects.
// Map new project id to the corresponding old one based on file path and project name (includes TFM), if it exists, and null for added projects.
// Deleted projects won't be included in this map.
var projectIdMap = projectInfos.ToDictionary(
keySelector: static info => info.Id,
elementSelector: info => oldProjectIdsByPath.TryGetValue(info.FilePath!, out var oldProjectId) ? oldProjectId : null);
elementSelector: info => oldProjectIdsByPath.TryGetValue((info.FilePath!, info.Name), out var oldProjectId) ? oldProjectId : null);

var newSolution = oldSolution;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;$(CurrentTargetFramework)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down

0 comments on commit 2f99a87

Please sign in to comment.