- C# 100%
Implements the slnfc tool: generate a .slnf solution filter from a .slnx or .sln via an interactive TUI, with --sln targeting and -m/--multiple batch creation. Includes README and PLAN. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| src/Slnfc | ||
| .gitignore | ||
| CLAUDE.md | ||
| PLAN.md | ||
| README.md | ||
| Slnfc.slnx | ||
Slnfc
Slnfc is a small terminal tool that builds a solution filter (.slnf) from a solution file. Point it at an .slnx (or a classic .sln), pick the projects you want in an interactive TUI, name the filter, and it writes the .slnf next to the solution.
Features
- Reads projects from
.slnx(XML) and classic.slnsolutions, including projects nested in solution folders. - Interactive selection powered by Spectre.Console.
- Targets either the given solution or a same-named sibling of the other type (a migrated
.slnx/.slnpair) — chosen via a prompt when both exist. --slnoverride to reference a differently named solution or one in another folder.--multiplemode to produce several filters in a single run.- Confirms before overwriting an existing
.slnf.
Requirements
- .NET 10 SDK or newer.
Usage
slnfc <solution.slnx|.sln> [-m|--multiple] [--sln <path>]
Running it opens a TUI that lists every project in the solution. Toggle projects with space, confirm with enter, then enter a name for the filter. The resulting <name>.slnf is written in the same directory as the solution.
Options
| Option | Description |
|---|---|
-m, --multiple |
Create several filters in one run. Asks how many, then repeats the select/name step for each. |
--sln <path> |
Reference this .sln/.slnx in the filter instead of the input (resolved relative to the input's directory). Its project list is used and the sibling prompt is skipped. |
-h, --help |
Show usage. |
Examples
Create a filter from a solution:
slnfc ./MySolution.slnx
When both MySolution.slnx and MySolution.sln exist, you'll be asked which one the filter should reference.
Reference a .sln that lives in a different folder:
slnfc ./MySolution.slnx --sln ./build/Release.sln
Create three filters in one session:
slnfc ./MySolution.slnx --multiple
Output
The generated .slnf is standard JSON understood by the .NET tooling and Visual Studio. solution.path is the target solution relative to the filter, and each project path is relative to the solution's directory:
{
"solution": {
"path": "MySolution.slnx",
"projects": [
"src/App/App.csproj",
"src/Core/Core.csproj"
]
}
}
You can then work against the filter directly, e.g.:
dotnet sln MySolution.slnf list
dotnet build MySolution.slnf
Building
Build and run from source:
dotnet run --project src/Slnfc -- ./MySolution.slnx
Publish a self-contained single-file executable (pass the runtime identifier for your platform):
dotnet publish src/Slnfc/Slnfc.csproj -c Release -r linux-x64 --self-contained
The executable is produced at src/Slnfc/bin/Release/net10.0/<rid>/publish/slnfc.