![]() |
VOOZH | about |
dotnet add package editorconfig --version 0.16.2
NuGet\Install-Package editorconfig -Version 0.16.2
<PackageReference Include="editorconfig" Version="0.16.2" />
<PackageVersion Include="editorconfig" Version="0.16.2" />Directory.Packages.props
<PackageReference Include="editorconfig" />Project file
paket add editorconfig --version 0.16.2
#r "nuget: editorconfig, 0.16.2"
#:package editorconfig@0.16.2
#addin nuget:?package=editorconfig&version=0.16.2Install as a Cake Addin
#tool nuget:?package=editorconfig&version=0.16.2Install as a Cake Tool
The EditorConfig .NET core provides the same functionality as the EditorConfig C Core and EditorConfig Python Core.
Library (NuGet):
dotnet add package editorconfig
CLI tool:
dotnet tool install --global editorconfig-tool
The tool ships as a native AOT binary for each supported platform. When you
run dotnet tool install, the correct pre-compiled native binary is selected
automatically — no .NET runtime required at invocation time:
| Platform | RID |
|---|---|
| Linux x64 | linux-x64 |
| Linux Arm64 | linux-arm64 |
| Windows x64 | win-x64 |
| Windows Arm64 | win-arm64 |
| macOS Apple Silicon | osx-arm64 |
A framework-dependent fallback (any) is included for other platforms.
// Recommended: caching and default filesystem
var parser = new EditorConfigParser();
var config = parser.Parse(fileName);
foreach (var kv in config.Properties)
Console.WriteLine("{0}={1}", kv.Key, kv.Value);
When processing many files in one run (e.g. a formatter or linter), reuse the
same EditorConfigParser instance. The parser caches both compiled glob matchers
and the resolved .editorconfig chain per directory — so the second and subsequent
files in the same directory cost only a dictionary lookup plus glob matching,
with zero traversal overhead.
var parser = new EditorConfigParser();
// All files share one parser instance; files in the same directory
// share one resolved chain automatically.
var results = parser.Parse(file1, file2, file3 /*, ... */);
For explicit control (e.g. grouping files by directory yourself):
var chain = parser.GetResolvedChain(file1); // traverses once for this directory
var cfg1 = parser.Parse(file1, chain);
var cfg2 = parser.Parse(file2, chain); // zero traversal — same directory
Pass an IFileSystem
from System.IO.Abstractions
when you need a testable or virtual file system:
// Caching is enabled automatically
var parser = new EditorConfigParser(myFileSystem);
When fileSystem is omitted the library uses new FileSystem() (the real disk).
The library is designed to be high-performance and allocation-light.
ref struct over
ReadOnlySpan<char>, so matching produces no heap allocations.[GeneratedRegex] on
.NET 7+ for optimal regex throughput..editorconfig files are resolved once per
directory per parser instance. For a repository with thousands of source files,
the traversal and File.Exists checks are paid at most once per unique directory.EditorConfigFileCache (used by default) caches
parsed files by path + modification time + size. Cache hits require only a
single metadata stat with no file read.Benchmark results on Apple M2 Pro · .NET 10 · Arm64:
| Scenario | Time | Allocations |
|---|---|---|
| Single file, warm parser | 1.3 μs | 1.5 KB |
| 50 files, same directory, warm parser | 63 μs | 82 KB |
| Glob match (pre-compiled, per match) | 4.7 μs | 0 B |
The library targets netstandard2.0, net462, and net10.0. All three targets
are functionally equivalent. The net10.0 target enables additional performance
features (source-generated regexes, AOT compatibility).
You can omit dotnet if installed as a global tool:
> dotnet editorconfig
Usage: editorconfig [OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]
EditorConfig .NET Core Version 0.12
Options:
-h, --help output usage information
-V, --version output the version number
-f <path> Specify conf filename other than ".editorconfig"
-b <version> Specify version (used by devs to test compatibility)
Example:
> dotnet editorconfig anatomy.md
charset=utf-8
insert_final_newline=true
end_of_line=lf
tab_width=8
trim_trailing_whitespace=sometimes
Clone the repository and initialise the conformance test submodule:
git clone git@github.com:editorconfig/editorconfig-core-net.git
git submodule init
git submodule update
Build:
dotnet build
Run unit tests (TUnit):
dotnet run --project src/EditorConfig.Tests -c Release
Run the upstream editorconfig conformance suite (requires CMake):
cmake .
ctest .
Run benchmarks (BenchmarkDotNet):
dotnet run -c Release --project benchmarks/EditorConfig.Benchmarks
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on editorconfig:
| Package | Downloads |
|---|---|
|
Credfeto.Tsql.Formatter
TSQL Formatting tool |
|
|
Myriad.Core
Core Myriad library used for developing plugins |
|
|
Fantomas.Extras
Utility package for Fantomas |
|
|
Credfeto.DotNet.Code.Analysis.Overrides
Dotnet code analys rule management utilities |
Showing the top 3 popular GitHub repositories that depend on editorconfig:
| Repository | Stars |
|---|---|
|
nightroman/FarNet
Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript.
|
|
|
X-Sharp/XSharpPublic
Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
|
|
|
Elders/VSE-FormatDocumentOnSave
Visual Studio - Format Document on Save
|