Soenneker.Utils.File.Replacer
11.0.400
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.File.Replacer --version 11.0.400
NuGet\Install-Package Soenneker.Utils.File.Replacer -Version 11.0.400
<PackageReference Include="Soenneker.Utils.File.Replacer" Version="11.0.400" />
<PackageVersion Include="Soenneker.Utils.File.Replacer" Version="11.0.400" />
<PackageReference Include="Soenneker.Utils.File.Replacer" />
paket add Soenneker.Utils.File.Replacer --version 11.0.400
#r "nuget: Soenneker.Utils.File.Replacer, 11.0.400"
#:package Soenneker.Utils.File.Replacer@11.0.400
#addin nuget:?package=Soenneker.Utils.File.Replacer&version=11.0.400
#tool nuget:?package=Soenneker.Utils.File.Replacer&version=11.0.400
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Utils.Directory (>= 11.0.973)
- Soenneker.Utils.File (>= 11.0.2333)
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 |
Updated Soenneker.Utils.File to 11.0.2333