Skip to content

Commit 94310a7

Browse files
committed
Nit
1 parent 8b22cd9 commit 94310a7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Cli/dotnet/Commands/Solution/Add/SolutionAddCommand.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,13 @@ private async Task AddProjectsToSolutionAsync(IEnumerable<string> projectPaths,
123123

124124
foreach (var projectPath in projectPaths)
125125
{
126-
// TODO: Remove this when we have a better way to handle this
127-
string solutionRelativeProjectPath = Path.GetRelativePath(Path.GetDirectoryName(_solutionFileFullPath), projectPath);
128-
// Generate the solution folder path based on the project path
129-
SolutionFolderModel? solutionFolder = GenerateIntermediateSolutionFoldersForProjectPath(solution, solutionRelativeProjectPath);
130-
AddProject(solution, projectPath, solutionFolder, serializer);
126+
AddProject(solution, projectPath, serializer);
131127
}
132128

133129
await serializer.SaveAsync(_solutionFileFullPath, solution, cancellationToken);
134130
}
135131

136-
private void AddProject(SolutionModel solution, string fullProjectPath, SolutionFolderModel solutionFolder, ISolutionSerializer serializer = null)
132+
private void AddProject(SolutionModel solution, string fullProjectPath, ISolutionSerializer serializer = null)
137133
{
138134
string solutionRelativeProjectPath = Path.GetRelativePath(Path.GetDirectoryName(_solutionFileFullPath), fullProjectPath);
139135

@@ -154,6 +150,9 @@ private void AddProject(SolutionModel solution, string fullProjectPath, Solution
154150
string projectTypeGuid = solution.ProjectTypes.FirstOrDefault(t => t.Extension == Path.GetExtension(fullProjectPath))?.ProjectTypeId.ToString()
155151
?? projectRootElement.GetProjectTypeGuid() ?? projectInstance.GetDefaultProjectTypeGuid();
156152

153+
// Generate the solution folder path based on the project path
154+
SolutionFolderModel? solutionFolder = GenerateIntermediateSolutionFoldersForProjectPath(solution, solutionRelativeProjectPath);
155+
157156
SolutionProjectModel project;
158157

159158
try
@@ -196,8 +195,6 @@ private void AddProject(SolutionModel solution, string fullProjectPath, Solution
196195
project.AddProjectConfigurationRule(new ConfigurationRule(BuildDimension.BuildType, solutionBuildType, "*", projectBuildType));
197196
}
198197

199-
200-
201198
Reporter.Output.WriteLine(CliStrings.ProjectAddedToTheSolution, solutionRelativeProjectPath);
202199
}
203200
}

0 commit comments

Comments
 (0)