https://github.com/belav/csharpier
CSharpier is an opinionated code formatter for c#.
https://github.com/belav/csharpier
csharp dotnet formatter prettier
Last synced: about 1 month ago
JSON representation
CSharpier is an opinionated code formatter for c#.
- Host: GitHub
- URL: https://github.com/belav/csharpier
- Owner: belav
- License: mit
- Created: 2020-11-17T21:52:19.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2026-10-05T20:03:05.000Z (about 2 months ago)
- Last Synced: 2026-10-09T01:31:51.145Z (about 2 months ago)
- Topics: csharp, dotnet, formatter, prettier
- Language: C#
- Homepage: https://csharpier.com
- Size: 8.05 MB
- Stars: 2,345
- Watchers: 13
- Forks: 162
- Open Issues: 98
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-c-sharp - belav/csharpier - CSharpier is an opinionated code formatter for c\#. (Language and Tooling / Linters and Formatters)
- fucking-awesome-dotnet - CSharpier - An opinionated code formatter for c\# that is based on the [Prettier](https://github.com/prettier/prettier) printing process. (Tools)
- awsome-dotnet - CSharpier - An opinionated code formatter for c# that is based on the [Prettier](https://github.com/prettier/prettier) printing process. (Tools)
- awesome-csharp - CSharpier - An opinionated code formatter for c# that is based on the [Prettier](https://github.com/prettier/prettier) printing process. (Tools)
- awesome-dotnet - CSharpier - An opinionated code formatter for c# that is based on the [Prettier](https://github.com/prettier/prettier) printing process. (Tools / GUI - other)
- awesome-dotnet - CSharpier
README

CSharpier is an opinionated code formatter for c# and XML. It parses your code and re-prints it using its own rules.
The printing process was ported from [prettier](https://github.com/prettier/prettier) but has evolved over time.
CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html) of prettier.
### Quick Start
Install CSharpier globally using the following command.
```bash
dotnet tool install -g csharpier
```
Then format the contents of a directory and its children with the following command.
```bash
csharpier format .
```
CSharpier can also format [on save in your editor](https://csharpier.com/docs/Editors) or as a [pre-commit hook](https://csharpier.com/docs/Pre-commit). Then you can ensure code was formatted with a [CI/CD tool](https://csharpier.com/docs/ContinuousIntegration).
---
[Read the documentation](https://csharpier.com)
[Try it out](https://playground.csharpier.com)
---
### Before
```c#
public class ClassName {
public void CallMethod() {
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
```
### After
```c#
public class ClassName
{
public void CallMethod()
{
this.LongUglyMethod(
"1234567890",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
);
}
}
```
## Contributing
See [Development Readme](CONTRIBUTING.md)
Join Us [](https://discord.gg/HfAKGEZQcX)
## Sponsors
Thanks to the following companies for sponsoring the ongoing development of CSharpier.
[.NET on AWS Open Source Software Fund](https://github.com/aws/dotnet-foss) \
\
[
](https://github.com/aws/dotnet-foss)
[Fern](https://buildwithfern.com/) \
\
[
]((https://buildwithfern.com/))
And a huge thanks to all the others who sponsor the project through [Github sponsors](https://github.com/sponsors/belav)