Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Cli/dotnet/commands/dotnet-sln/add/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ private async Task AddProjectsToSolutionAsync(string solutionFileFullPath, IEnum
foreach (var projectPath in projectPaths)
{
string relativePath = Path.GetRelativePath(Path.GetDirectoryName(solutionFileFullPath), projectPath);
// Add fallback solution folder if relative path does not contain `..`.
string relativeSolutionFolder = relativePath.Split(Path.DirectorySeparatorChar).Any(p => p == "..")
// Add auto-generated solution folder if relative path exists in the solution directory
string relativeSolutionFolder = (relativePath.Split(Path.DirectorySeparatorChar).Any(p => p == "..") || Path.IsPathRooted(relativePath))
? string.Empty : Path.GetDirectoryName(relativePath);

if (!_inRoot && solutionFolder is null && !string.IsNullOrEmpty(relativeSolutionFolder))
Expand Down
Loading