codeformatter
codeformatter copied to clipboard
Add ability to run on OS X / Xamarin Studio
Would be nice if this could be used outside Windows.
In the xplat branch, we've been using monodevelop / Xamarin Studio. Have you tried that branch? And if so what issues are you seeing?
Nope, haven't tried yet, wasn't aware of it. Thanks for the pointer!
I'll close this then. Reopen if you have any issues.
Uhg, I was working in the msbuild repo and clicked on this issue link in my email... There's definitely not an xplat branch or Linux support here, so I'll reopen. Sorry about that!
Found out about this project early this morning and was all like

that was until:
› mono CodeFormatter.exe ../../src/SuperSecret.sln
ERROR: Type loading error detected. In order to run this tool you need either
Visual Studio 2015 or Microsoft Build Tools 2015 tools installed.
- Could not load file or assembly or one of its dependencies.
A while back I took on ownership of a fork for narrange and wrote a corresponding plugin for monodevelop. I would be keen in working with someone (@mteper)? to make codeformater a first class citizen.
@AndyGerlicher is there a xplat branch hidden somewhere within MSFT for codeformater?
I think cross plat is a goal we should definitely shoot for on this tool. The code in the tool itself should be fine for cross plat. It may need a little work but nothing series. The bigger issue is our dependencies.
The Roslyn code uses the MSBuild APIs to create a Solution object from the provided solution and project files. The MSBuild DLLs, and the Roslyn DLLs which depend on it, are not designed to be cross platform. I imagine it will take some level of work to get this running cross platform.
The good news though is MSBuild is moving to cross plat support so this should be a very doable proposition for us. It will probably take a bit of effort though.
Another option is to have a cross plat version of the tool which only supports the rsp command line arguments. This doesn't need cross plat support to read in and hence should in theory just work.
Either way, something to explore.
Note: in the future could we have less GIFs in the thread? Having a toddler swaying back and forth on my screen is simply distracting when trying to type up responses to issues :smile:
I thought Roslyn was already xplat? Doesn't Refit rely in Roslyn bits?
@mteper large parts of Roslyn are cross platform. The portion that uses MSBuild though is not. At least to my knowledge.
@jaredpar Just quickly scanning the package files, is it the Microsoft.CodeAnalysis.Workspaces.Common stuff?
@mteper in general the rule is
- If the Roslyn assembly name ends in
.Desktopthen it's not portable - Else it is portable
In this particular scenario the Workspaces.*.Deskop assemblies are the ones we'll need to look into. They depend on MSBuild which is non-portable.
Note: Even if it is a Desktop assembly it still will often work just fine on Mono.
I looked at the Roslyn code on CodePlex and it looks like the .Desktop stuff takes direct dependencies on MSBuild assemblies that ship with VS. Next place to look would be to see whether there is a nuget-exposed artifact of the newly OSS'ed MSBuild code that can be plugged in instead. Unfortunately, I am too swamped to do even that much (little?) right now. Sorry!! :(
@mteper
Make sure to look on GitHub for the latest Roslyn sources. The CodePlex ones are about 4 months out of date by now.
The new OSS MSBuild does not yet expose a NuGet package that Roslyn could consume. Hopefully meeting with them later this week to discuss producing some new packages (for other related reasons). If I can I met try and hook that up to Roslyn.
:+1: I googled Roslyn source and ended up on CodePlex, good to know they moved to GitHub. Will look there next time I come up for air. :)
Any progress on this?
@naveensrinivasan yes. There is a Workspace implementation that came out of the dotnet/cli project that will be useful in allowing codeformatter to become a portable application. It still needs some work but I'm hoping early next year it will be available.
Thanks!
Just wanted to add a +1 to this request, seems like it's being considered though which is great news! We'd benefit a lot from this for our projects.
:+1:
This feature request is 3.5 years old. Is there any movement on supporting .NET Core, so we can run this tool outside of Windows? Or is that just a lost cause because of the way the tool is written? We would love to be able to run this during CI but our builds are all on Linux.
@bradwilson might I interest you in this? https://github.com/dotnet/roslyn/tree/44157c305d95ab505a6401229f2153c26ba78353/src/Tools/dotnet-format
@jmarolf Which parts of .editorconfig does this tool support? The docs didn't seem to indicate, and when I ran it across one of my sample projects, it made zero edits.
@bradwilson https://github.com/dotnet/codeformatter/issues/201#issuecomment-411408273
Which parts of .editorconfig does this tool support?
@JoeRobich I though dotnet format supported all of the editorconfig options for .NET?
@bradwilson Sorry we were broken for a bit. There were some issues assembly resolution issues with the core 3.0.0 sdk. @sharwell has a fix in master for them. dotnet format is the equivalent of running Format Document from VS, so it should support all of the .editorconfig options.