Slnx.Combine
0.6.1
dotnet tool install --global Slnx.Combine --version 0.6.1
dotnet new tool-manifest
dotnet tool install --local Slnx.Combine --version 0.6.1
#tool dotnet:?package=Slnx.Combine&version=0.6.1
nuke :add-package Slnx.Combine --version 0.6.1
slnx-combiner
slnx-combine is a .NET tool that searches one or more directories and their subdirectories for Visual Studio solution files (.sln and .slnx) and combines their projects into one XML solution (.slnx).
Install
dotnet tool install --global Slnx.Combine
Usage
slnx-combine <Output> [TraverseDirectory ...] [OPTIONS]
slnx-combine combine <Output> [TraverseDirectory ...] [OPTIONS]
Outputis the generated solution path. If its extension is not.slnx, the tool changes it to.slnx.TraverseDirectoryis a directory searched recursively for.slnand.slnxfiles. Supply multiple directories to search all of them. When omitted, the output file's directory is searched.
Options
| Option | Description |
|---|---|
--overwrite |
Overwrite the output file if it already exists. |
--include <REGEX> |
Include only solution filenames that match the regular expression. |
--exclude <REGEX> |
Exclude solution filenames that match the regular expression. |
Include and exclude expressions are case-insensitive and match the filename without its extension. Invalid expressions are reported before file discovery starts. The filters can be combined: inclusion is applied first, followed by exclusion.
Examples
When installed as a global .NET tool from NuGet:
slnx-combine combined.slnx C:\code\my-repository
Search multiple directories:
slnx-combine combined.slnx C:\code\services C:\code\libraries
Include solution names beginning with Team-, but exclude names ending in -Tests:
slnx-combine combined.slnx C:\code\my-repository --include '^Team-' --exclude '-Tests$'
The combine workflow can also be invoked through the explicit combine command:
slnx-combine combine combined.slnx C:\code\my-repository
When running the project directly:
dotnet run --project src/SlnxCombiner/SlnxCombiner.csproj -- combined.slnx C:\code\my-repository
The output file is excluded from the discovered input solutions. Files found through overlapping traversal directories are de-duplicated before they are combined. To regenerate an existing combined solution in place, pass --overwrite.
How the combined solution is generated
For every discovered solution, the tool:
- Reads all of its projects.
- Resolves project paths relative to that input solution.
- Rewrites the paths relative to the generated output file.
- Places the projects in a solution folder named after the input solution file.
If multiple input solutions have the same filename, their generated folder names receive suffixes such as _1 and _2. A project referenced by more than one solution is emitted only once, directly under the root of the combined solution. Project display names and project type metadata are preserved when present.
For example, combining Api.slnx and Worker.sln, which both reference Shared.csproj, produces a structure similar to:
<Solution>
<Project Path="src/Shared/Shared.csproj" />
<Folder Name="/Api/">
<Project Path="src/Api/Api.csproj" />
</Folder>
<Folder Name="/Worker/">
<Project Path="src/Worker/Worker.csproj" />
</Folder>
</Solution>
The exact relative paths depend on the locations of the input solutions, projects, and output file.
Build and test
dotnet test slnx-combiner.slnx
Publish
Releases are published manually through the Publish NuGet package GitHub Actions workflow using NuGet trusted publishing. Before the first release:
- Add a nuget.org trusted publishing policy with repository owner
jeppevammenkristensen, repositoryslnx-combiner, workflow filepublish-nuget.yml, and no environment. - Ensure the GitHub Actions repository variable
NUGET_USERis set to the package owner's nuget.org profile username (jeppev). - Open Actions, select Publish NuGet package, choose Run workflow, and enter the package version to publish.
The workflow tests the solution, packs the requested version, exchanges GitHub's OIDC token for a short-lived NuGet API key, and publishes the package without a stored API-key secret.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
- Updated internal package references to latest versions