Skip to content
Merged
Show file tree
Hide file tree
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: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- [CLI] Fix loading of `slnf` files ([PR](https://github.com/dotnet/roslynator/pull/1447))

## [4.12.1] - 2024-04-15

### Changed
Expand Down
3 changes: 2 additions & 1 deletion src/CommandLine/CommandLineHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static bool IsGlobPatternForProject(string pattern)

public static bool IsGlobPatternForSolution(string pattern)
{
return pattern.EndsWith(".sln", StringComparison.OrdinalIgnoreCase);
return pattern.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)
|| pattern.EndsWith(".slnf", StringComparison.OrdinalIgnoreCase);
}

public static void WaitForKeyPress(string message = null)
Expand Down
12 changes: 10 additions & 2 deletions src/CommandLine/Commands/MSBuildWorkspaceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public async Task<CommandStatus> ExecuteAsync(IEnumerable<PathInfo> paths, strin
{
if (path.Origin == PathOrigin.PipedInput)
{
Matcher matcher = (string.Equals(Path.GetExtension(path.Path), ".sln", StringComparison.OrdinalIgnoreCase))
Matcher matcher = (IsSolutionFile(path.Path))
? ProjectFilter.SolutionMatcher
: ProjectFilter.Matcher;

Expand Down Expand Up @@ -225,7 +225,7 @@ private static async Task<ProjectOrSolution> OpenProjectOrSolutionAsync(
IProgress<ProjectLoadProgress> progress = null,
CancellationToken cancellationToken = default)
{
bool isSolution = string.Equals(Path.GetExtension(path), ".sln", StringComparison.OrdinalIgnoreCase);
bool isSolution = IsSolutionFile(path);

WriteLine($"Loading {((isSolution) ? "solution" : "project")} '{path}'...", Verbosity.Minimal);

Expand Down Expand Up @@ -405,6 +405,14 @@ private protected async Task<ImmutableArray<Compilation>> GetCompilationsAsync(
}
}

private static bool IsSolutionFile(string path)
{
string extension = Path.GetExtension(path);

return string.Equals(extension, ".sln", StringComparison.OrdinalIgnoreCase)
|| string.Equals(extension, ".slnf", StringComparison.OrdinalIgnoreCase);
}

protected class ConsoleProgressReporter : IProgress<ProjectLoadProgress>
{
public static ConsoleProgressReporter Default { get; } = new();
Expand Down