dotnet / format

Home for the dotnet-format command
MIT License
1.94k stars 173 forks source link

Support formatting .csproj .sln #647

Open snebjorn opened 4 years ago

snebjorn commented 4 years ago

Hi I just noticed that the .csproj file isn't formatted when running dotnet-format. I'm assuming it's the same for .sln.

Think it would be a good to also format these files.

nothrow commented 4 years ago

It would be nice to also format Solution Files (for example, docker-compose.yaml). At least whitespace/tabs + newlines.

LordMike commented 2 years ago

I took a stab at making a csproj formatter once, I found some neat ways I could trick the msbuild project system to load my csproj files while preserving formatting.

My code supports a few scenarios:

It could work as a starting point for what's possible. It'd be great to have this and more in dotnet-format instead of my code.. :)

flobernd commented 1 year ago

@JoeRobich Any updates on this one?

Just checking the basic editorconfig rules like indentation, eol, etc. should be fine in this case. A large part of the code for that should already be present in dotnet-format anyways.

The team quite often manage to commit tabs in our *.csproj files and our dotnet-format based linter is not able to catch this.

tcartwright commented 3 weeks ago

Upvote