codeformatter icon indicating copy to clipboard operation
codeformatter copied to clipboard

Add ability to run on OS X / Xamarin Studio

Open mteper opened this issue 10 years ago • 24 comments
trafficstars

Would be nice if this could be used outside Windows.

mteper avatar Apr 10 '15 00:04 mteper

In the xplat branch, we've been using monodevelop / Xamarin Studio. Have you tried that branch? And if so what issues are you seeing?

AndyGerlicher avatar Apr 10 '15 16:04 AndyGerlicher

Nope, haven't tried yet, wasn't aware of it. Thanks for the pointer!

mteper avatar Apr 10 '15 16:04 mteper

I'll close this then. Reopen if you have any issues.

AndyGerlicher avatar Apr 10 '15 16:04 AndyGerlicher

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!

AndyGerlicher avatar Apr 10 '15 16:04 AndyGerlicher

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?

ghuntley avatar Apr 27 '15 23:04 ghuntley

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:

jaredpar avatar Apr 28 '15 00:04 jaredpar

I thought Roslyn was already xplat? Doesn't Refit rely in Roslyn bits?

mteper avatar Apr 28 '15 02:04 mteper

@mteper large parts of Roslyn are cross platform. The portion that uses MSBuild though is not. At least to my knowledge.

jaredpar avatar Apr 28 '15 02:04 jaredpar

@jaredpar Just quickly scanning the package files, is it the Microsoft.CodeAnalysis.Workspaces.Common stuff?

mteper avatar Apr 28 '15 03:04 mteper

@mteper in general the rule is

  • If the Roslyn assembly name ends in .Desktop then 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.

jaredpar avatar Apr 28 '15 03:04 jaredpar

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 avatar Apr 28 '15 03:04 mteper

@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.

jaredpar avatar Apr 28 '15 03:04 jaredpar

:+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. :)

mteper avatar Apr 28 '15 03:04 mteper

Any progress on this?

naveensrinivasan avatar Dec 19 '15 20:12 naveensrinivasan

@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.

jaredpar avatar Dec 24 '15 00:12 jaredpar

Thanks!

naveensrinivasan avatar Dec 24 '15 00:12 naveensrinivasan

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.

elliotblackburn avatar Feb 05 '16 17:02 elliotblackburn

:+1:

piot avatar Mar 01 '16 15:03 piot

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 avatar Jan 29 '19 19:01 bradwilson

@bradwilson might I interest you in this? https://github.com/dotnet/roslyn/tree/44157c305d95ab505a6401229f2153c26ba78353/src/Tools/dotnet-format

jmarolf avatar Jan 30 '19 01:01 jmarolf

@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 avatar Jan 30 '19 08:01 bradwilson

@bradwilson https://github.com/dotnet/codeformatter/issues/201#issuecomment-411408273

ghuntley avatar Jan 30 '19 09:01 ghuntley

Which parts of .editorconfig does this tool support?

@JoeRobich I though dotnet format supported all of the editorconfig options for .NET?

jmarolf avatar Jan 30 '19 09:01 jmarolf

@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.

JoeRobich avatar Jan 30 '19 17:01 JoeRobich