Skip to content

Commit 0d20f00

Browse files
committed
Also check for non rooted paths
1 parent d79ec02 commit 0d20f00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Cli/dotnet/commands/dotnet-sln/add/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private async Task AddProjectsToSolutionAsync(string solutionFileFullPath, IEnum
101101
{
102102
string relativePath = Path.GetRelativePath(Path.GetDirectoryName(solutionFileFullPath), projectPath);
103103
// Add fallback solution folder if relative path does not contain `..`.
104-
string relativeSolutionFolder = relativePath.Split(Path.DirectorySeparatorChar).Any(p => p == "..")
104+
string relativeSolutionFolder = (relativePath.StartsWith("..") || Path.IsPathRooted(relativePath))
105105
? string.Empty : Path.GetDirectoryName(relativePath);
106106

107107
if (!_inRoot && solutionFolder is null && !string.IsNullOrEmpty(relativeSolutionFolder))

0 commit comments

Comments
 (0)