Meziantou.Framework.FullPath 2.1.2

Prefix Reserved
dotnet add package Meziantou.Framework.FullPath --version 2.1.2
                    
NuGet\Install-Package Meziantou.Framework.FullPath -Version 2.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.FullPath" Version="2.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.FullPath" Version="2.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.FullPath" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.FullPath --version 2.1.2
                    
#r "nuget: Meziantou.Framework.FullPath, 2.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.FullPath@2.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.FullPath&version=2.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.FullPath&version=2.1.2
                    
Install as a Cake Tool

Meziantou.Framework.FullPath

FullPath ensures you always deal with full path in your application and provides many common methods to manipulate paths.

// Create FullPath
FullPath rootPath = FullPath.FromPath("demo"); // It automatically calls Path.GetFullPath to resolve the path
FullPath filePath = FullPath.Combine(rootPath, "temp", "meziantou.txt"); // Use Path.Combine to join paths (you can combine as many path as you needed)
FullPath temp = FullPath.GetTempPath(); // equivalent of Path.GetTempPath()
FullPath cwd = FullPath.GetCurrentDirectory(); // equivalent of Environment.CurrentDirectory

// Combine path: you can use the / operator to join path
FullPath filePath1 = rootPath / "temp" / "meziantou.txt";
// Or use the + operator to append a suffix to the current path
FullPath backupFilePath = filePath1 + ".bak";

// Compare path
// Comparisons are case-insensitive on Windows and case-sensitive on other operating systems by default
_ = filePath == rootPath;
_ = filePath.Equals(rootPath, ignoreCase: false);

// Get parent directory
FullPath parent = filePath.Parent;

// Get file/directory name - extension
var name = filePath.Name;
var ext = filePath.Extension;
FullPath pathWithExtension = filePath.WithExtension(".log");
FullPath pathWithAllExtensionsChanged = FullPath.FromPath("archive.tar.gz").WithExtension(".zip", replaceAllTrailingExtensions: true);
FullPath pathWithTwoExtensionsChanged = FullPath.FromPath("archive.tar.gz").WithExtension(".zip", extensionCount: 2);
FullPath pathWithNewName = filePath.WithName("other.txt");
FullPath pathWithNewNameWithoutExtension = filePath.WithNameWithoutExtension("other");

// Make relative path
string relativePath = filePath.MakeRelativeTo(rootPath); // temp\meziantou.txt

// Check if a path is under another path
bool isChildOf = filePath.IsChildOf(rootPath);

// Resolve to canonical final path (follows symbolic links/reparse points)
if (filePath.TryGetCanonicalPath(out var canonicalPath))
{
    Console.WriteLine(canonicalPath);
}

// FullPath is implicitly converted to string, so it works well with File/Directory methods
System.IO.File.WriteAllText(filePath, content);

Analyzer rules

Id Category Description Severity Enabled
MFFP0001 FullPath Use FullPath directly instead of Path.GetFullPath Info ✔️
MFFP0002 FullPath Use the right FullPath operand directly Info ✔️
MFFP0003 FullPath Use '/' with a FullPath base instead of Path.GetFullPath Info ✔️
MFFP0004 FullPath Use '/' operator instead of Path.Combine Info ✔️
MFFP0005 FullPath Use FullPath.Name instead of Path.GetFileName Info ✔️
MFFP0006 FullPath Use FullPath.NameWithoutExtension instead of Path.GetFileNameWithoutExtension Info ✔️
MFFP0007 FullPath Use FullPath.Extension instead of Path.GetExtension Info ✔️
MFFP0008 FullPath Use FullPath.Parent instead of Path.GetDirectoryName Info ✔️
MFFP0009 FullPath Use FullPath.ChangeExtension instead of Path.ChangeExtension Info ✔️
MFFP0010 FullPath Use FullPath.MakePathRelativeTo instead of Path.GetRelativePath Info ✔️
MFFP0011 FullPath Return FullPath instead of string Info ✔️

Additional resources

Product 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 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net11.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Meziantou.Framework.FullPath:

Package Downloads
Meziantou.Framework.InlineSnapshotTesting

Enables verification of objects using inline snapshots

Meziantou.Framework.TemporaryDirectory

TemporaryDirectory allows to create a disposable directory to store temporary files

ANcpLua.Roslyn.Utilities.Testing

Fluent testing framework for Roslyn analyzers, code fixes, and incremental generators with caching validation, forbidden type detection, and comprehensive assertion support.

Meziantou.Framework.NuGetPackageValidation

Provide rules to validate a NuGet package follows best practices

Meziantou.Framework.DiffEngine

Locate and resolve external diff tools

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Meziantou.Framework.FullPath:

Repository Stars
meziantou/Meziantou.Analyzer
A powerful C# Roslyn analyzer that uses static analysis to detect bugs, surface security issues, and enforce best practices—helping developers and AI write more reliable code.
workleap/wl-dotnet-codingstandards
Workleap recommended coding standards for .NET.
Version Downloads Last Updated
2.1.2 322 6/7/2026
2.1.1 254 6/6/2026
2.1.0 54 6/6/2026
2.0.1 5,465 5/23/2026
2.0.0 4,853 5/6/2026
1.1.21 4,522 4/26/2026
1.1.20 288 4/25/2026
1.1.19 6,002 4/16/2026
1.1.18 8,612 3/29/2026
1.1.17 1,979 3/15/2026
1.1.16 7,148 2/22/2026
1.1.15 4,035 2/9/2026
1.1.14 2,217 1/25/2026
1.1.13 1,327 1/18/2026
1.1.12 7,521 12/14/2025
1.1.11 1,807 12/7/2025
1.1.10 6,627 11/30/2025
1.1.9 920 11/23/2025
1.1.8 5,592 11/16/2025
1.1.7 1,371 11/9/2025
Loading failed