Soenneker.Utils.File.Replacer 11.0.410

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.File.Replacer --version 11.0.410
                    
NuGet\Install-Package Soenneker.Utils.File.Replacer -Version 11.0.410
                    
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="Soenneker.Utils.File.Replacer" Version="11.0.410" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.File.Replacer" Version="11.0.410" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.File.Replacer" />
                    
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 Soenneker.Utils.File.Replacer --version 11.0.410
                    
#r "nuget: Soenneker.Utils.File.Replacer, 11.0.410"
                    
#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 Soenneker.Utils.File.Replacer@11.0.410
                    
#: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=Soenneker.Utils.File.Replacer&version=11.0.410
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.File.Replacer&version=11.0.410
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Utils.File.Replacer

Replaces ordinal, case-sensitive text across files selected by a filesystem search pattern.

Installation

dotnet add package Soenneker.Utils.File.Replacer

Registration

builder.Services.AddFileReplacerAsSingleton();

Scoped registration is also available with AddFileReplacerAsScoped().

Usage

bool changed = await replacer.ReplaceString(
    directoryPath: repositoryPath,
    searchPattern: "*.cs",
    targetString: "Old.Namespace",
    replacementString: "New.Namespace",
    includeSubdirectories: true,
    cancellationToken);

searchPattern uses the platform filesystem matcher and supports patterns such as *.cs, Service*.json, and file?.txt. An empty pattern is treated as *. Recursive enumeration skips symbolic links, junctions, and other reparse points.

The replacement uses StringComparison.Ordinal; casing must match exactly. true means at least one file was changed. false means the directory or target was invalid, no match was found, or every matching file failed to process. Individual file and enumeration failures are logged.

Each changed file is written to a temporary sibling and moved over the original only after the new contents are complete. Cancellation therefore does not leave a half-written version of the file being processed. The operation is not transactional across the directory: files completed before a later error or cancellation stay changed.

This utility reads each selected file as text and writes UTF-8 without a byte-order mark. Limit the search pattern to known text files; selecting binaries or files whose exact encoding/BOM must be preserved can corrupt or alter them. Review changes in version control before using broad replacements.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.0.416 87 11/19/2026
11.0.415 86 11/19/2026
11.0.414 89 11/18/2026
11.0.413 89 11/18/2026
11.0.412 84 11/18/2026
11.0.410 86 11/18/2026
11.0.409 88 11/15/2026
11.0.408 117 11/11/2026
11.0.407 99 11/11/2026
11.0.406 92 11/11/2026
11.0.404 101 11/11/2026
11.0.403 107 11/11/2026
11.0.402 99 11/11/2026
11.0.401 92 11/11/2026
11.0.400 146 11/3/2026
11.0.399 90 11/3/2026
11.0.398 90 11/3/2026
11.0.397 98 11/3/2026
11.0.396 94 11/3/2026
11.0.395 94 11/2/2026
Loading failed

Updated Multiple NuGet packages