FileBasedApp.Toolkit
0.15.0
dotnet add package FileBasedApp.Toolkit --version 0.15.0
NuGet\Install-Package FileBasedApp.Toolkit -Version 0.15.0
<PackageReference Include="FileBasedApp.Toolkit" Version="0.15.0" />
<PackageVersion Include="FileBasedApp.Toolkit" Version="0.15.0" />
<PackageReference Include="FileBasedApp.Toolkit" />
paket add FileBasedApp.Toolkit --version 0.15.0
#r "nuget: FileBasedApp.Toolkit, 0.15.0"
#:package FileBasedApp.Toolkit@0.15.0
#addin nuget:?package=FileBasedApp.Toolkit&version=0.15.0
#tool nuget:?package=FileBasedApp.Toolkit&version=0.15.0
FileBasedApp.Toolkit
A collection of opinionated helpers and extensions for building file-based applications in .NET.
Features
- Provides a
PathUtilclass for working with paths and validating string paths - Provides an IO class to provide methods and extension methods for
TruePath - Provides an extension of the
CommandSettingsfrom theSpectre.Console.Cliproviding validation of file and directory paths - Includes the following libraries
TruePathSimpleExecSpectre.Console.CliTestableIO.System.IO.Abstractions.WrappersTruePath.TestableIO.System.IO
Example
Extended settings
The example below shows how to use the ExtendedCommandSettings class to validate file and directory paths.
using FileBasedApp.Toolkit;
using Spectre.Console;
using Spectre.Console.Cli;
using TruePath;
public class CustomCommandSettings : ExtendedCommandSettings
{
[CommandArgument(0, "<directory-path>")]
public string? Directory { get; set; }
[CommandOption("--filePath")]
public required string File { get; set; }
public AbsolutePath DirectoryPath { get; set; }
public AbsolutePath FilePath { get; set; }
protected override ValidationResult DoValidate()
{
// Evaluates the directory string.
DirectoryPath = TryGetDirectory(Directory,
allowEmpty: true,
shouldExist: true,
PredefinedRootPath.ExecutionFolder);
FilePath = TryGetFile(File, true, roots: [PathUtil.GetCurrentWorkingFolder(), PathUtil.GetExecutionFolder()]);
return base.DoValidate();
}
}
TruePath IO extensions
using System.IO.Abstractions;
using FileBasedApp.Toolkit;
var applicationData = Environment.SpecialFolder.ApplicationData.GetSpecialFolder();
applicationData.FindRequiredParent(x => x.FileName == "SomeValue");
var ancestors = applicationData.GetAncestors(true).ToList();
// Combining with TruePath.TestableIO.System.IO
// This was orignally part of the FileBased.Toolkit library but moved
// to it's own library
var newDirectory = applicationData / "NewDirectory";
newDirectory.CreateDirectory();
IFileSystem fileSystem = new FileSystem();
fileSystem.File.Create(newDirectory / "test.txt");
(newDirectory / "..").GetDirectories(fileSystem)
Template
You can use the FileBasedApp.Toolkit.Template to easily create a new filebase app with FileBasedApp.Toolkit references added https://www.nuget.org/packages/FileBasedApp.Toolkit.Template/
Bugs or things missing
Feel free to create an issue or submit a pull request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- Microsoft.Bcl.Memory (>= 9.0.14)
- SimpleExec (>= 13.0.0)
- Spectre.Console.Cli (>= 0.53.1)
- TestableIO.System.IO.Abstractions.Wrappers (>= 22.1.0)
- TruePath (>= 1.11.0)
- TruePath.TestableIO.System.IO (>= 0.15.0)
-
net8.0
- Microsoft.Bcl.Memory (>= 9.0.14)
- SimpleExec (>= 13.0.0)
- Spectre.Console.Cli (>= 0.53.1)
- TestableIO.System.IO.Abstractions.Wrappers (>= 22.1.0)
- TruePath (>= 1.11.0)
- TruePath.TestableIO.System.IO (>= 0.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.15.0 | 13 | 3/13/2026 |
| 0.15.0-rc-01 | 49 | 3/12/2026 |
| 0.15.0-dev-05 | 41 | 3/11/2026 |
| 0.15.0-dev-03 | 40 | 3/11/2026 |
| 0.15.0-dev-02 | 28 | 3/11/2026 |
| 0.15.0-dev-01 | 72 | 3/11/2026 |
| 0.14.0 | 99 | 3/10/2026 |
| 0.14.0-preview-02 | 74 | 3/10/2026 |
| 0.13.0 | 74 | 3/8/2026 |
| 0.12.0 | 74 | 3/7/2026 |
| 0.11.2 | 83 | 3/5/2026 |
| 0.11.1 | 72 | 3/5/2026 |
| 0.11.0 | 77 | 3/5/2026 |
| 0.10.3 | 83 | 3/2/2026 |
| 0.10.2 | 132 | 2/28/2026 |
Added enumerable extensions for structs. Particulary aimed at AbsolutePath