SolutionFilterBuilder 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global SolutionFilterBuilder --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local SolutionFilterBuilder --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SolutionFilterBuilder&version=1.0.0                
nuke :add-package SolutionFilterBuilder --version 1.0.0                

SolutionFilterBuilder

A DotNet tool to create a solution filter form a Visual Studio solution, controlled by MSBuild project properties.

Build Nuget

Easily create a solution filter to avoid loading more than necessary, and update your filter whenever your solution changes.

This tool uses MSBuild logic to control which projects should be part of your filter, giving you a high grade of flexibility.

All projects containing a property IncludeInSolutionFilter set to true are included in the specified filter, along with all their referenced projects. A property SolutionFilterName is provided to be able to write MSBuild conditions based on the filter name.

You can mark individual projects by adding the IncludeInSolutionFilter property to the project file:

  • Include the project and all references in any filter:
    <IncludeInSolutionFilter>true</IncludeInSolutionFilter>
  • Include the project only if the filter name is Setup.slnf:
    <IncludeInSolutionFilter Condition="$'(SolutionFilterName)'=='Setup'">true</IncludeInSolutionFilter>

You can include several projects by convention by adding conditional properties in the Directory.Build.targets file:

  • Include all test projects in Test.slnf:
    <IncludeInSolutionFilter Condition="$'(IncludeInSolutionFilter)'=='' AND $(IsTestProject) AND '$(SolutionFilterName)'=='Test'">true</IncludeInSolutionFilter>
  • Include all projects ending with Something in Something.slnf:
    <_IsSomeProject>$(MSBuildProjectName.ToUpperInvariant().EndsWith("SOMETHING"))</_IsSomeProject>
    <IncludeInSolutionFilter Condition="'$(IncludeInSolutionFilter)'=='' AND $(_IsSomeProject) AND '$(SolutionFilterName)'=='Something'">true</IncludeInSolutionFilter>
  • Include all executables in Apps.slnf:
     <IncludeInSolutionFilter Condition="'$(IncludeInSolutionFilter)'=='' AND '$(OutputType)'=='Exe' AND '$(IsTestProject)'!='true' AND '$(SolutionFilterName)'=='Apps'">true</IncludeInSolutionFilter>

Usage

build-slnf [options]
Options
  -i, --input  <input>              The path to the solution file that is the source for the filter.
                                    If no solution is specified, it tries to find a single one in the current directory.
  -o, --output <output> (REQUIRED)  The name of the solution filter that is created.
                                    An existing file will be overwritten without confirmation.
  --version                         Show version information
  -?, -h, --help                    Show help and usage information
Sample

Build a solution filter Test.sln from the solution in the current directory.

build-slnf -o Test 
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.3 2,438 12/1/2023
1.0.2 398 6/22/2023
1.0.1 130 6/21/2023
1.0.0 248 2/18/2023