-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use ILSpy on linux with Mono #416
Comments
I am a Mono user, but I don't think ILSpy should attempt to support Mono, because
The core of ILSpy is highly portable, and dependencies such as Mono.Cecil, NRefactory, and ICSharpCode.Decompiler are already Mono compatible. I think the efforts should be focused on bringing the portable parts to Mono and integrated with MonoDevelop/Xamarin Studio where you can get assistance from a huge group of users. That should be more of a joy ride. |
Could you recommend a strategy to make a cli application for OS X? I don't need GUI, just a tool to decompile .Net dll and it feels possible with today's code. |
From what I see, one would need to exclude AvalonEdit and run |
Those "nodes" are still WPF tree nodes. Pretty much all the code in ILSpy is WPF-dependent UI code. MonoDevelop already uses ICSharpCode.Decompiler on OS X and Linux. |
I have not found a sane way to decompile a large library to source files in MonoDevelop/Xamarin. If you know how, please tell. Otherwise it's just infinite manual copy-pasting from GUI to text files. |
What about Edit 1: // ICSharpCode.ILSpy.AssemblyList
public LoadedAssembly OpenAssembly(string file, bool isAutoLoaded=false);
// ICSharpCode.ILSpy.CSharpLanguage
public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output,
DecompilationOptions options); DecompileAllCommand gives a nice example. |
Well, I am slowly getting further. There is no |
Ok, so I got it to decompile a library without references (it fails for |
It seems to work well now. I have modified few source files to get it through and now curious if I can avoid modifying the original sources. I'll try to find some time for testing it. |
I made a quick-n-dirty project to build for OS X but I guess it should work for Linux too, see https://github.com/andreif/ILSpyMono |
@andreif This has been very helpful, thanks. |
@mkrueger prepared a demo project for our SharpDevelop Developer Days in November outlining how a multi-targetting project could look like. We are leaning towards WPF for Windows, and having one head for Mac/Linux. But note that the core team is working on vNext of the underlying decompiler architecture, so it is a good time to chime in if you have xplat chops especially with xwt. |
Just found one more CLI project https://github.com/aerror2/ILSpy-For-MacOSX |
Isn't that for Mac?
|
It's called |
Hrm. While that project compiles, I get nasty errors about an incorrect
directory.
…
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb"
,"name":"GitHub"},"entity":{"external_key":"github/icsharpcode/ILSpy","title":
"icsharpcode/ILSpy","subtitle":"GitHub repository","main_image_url":"https://c
loud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-
7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/asse
ts/143418/15842166/7c72db34-2c0b-11e6-9aed-
b52498112777.png","action":{"name":"Open in
GitHub","url":"https://github.com/icsharpcode/ILSpy"}},"updates":{"snippets":[
***@***.*** in #416: It's called `ILSpy for Mac OS X
,Linux and any mono supported platform`"}],"action":{"name":"View
Issue","url":"#416 (comment)-
280940238"}}}
|
This fork exists, and the CLI version seems to work just fine on mono. (I'm running Parabola (99% the same as Arch) myself, and it works for me.) |
@PoroCYon sorry for necro-post, but this is not a fork, it's a completely different code (it's just based on some ilspy code) |
Has anyone spent a thought on using VS Code as the UI platform? |
That'd be nice. |
So far, even /newdecompiler isn't netstandard2 (might work though). When/if that lands, xplat UI should be a lot easier to pull off - re:VSCode, haven't ever looked into what it would take to implement a rather complex UI (in terms of interaction between JS and .NET, think memory, think the left-hand-side tree). If anyone has infos (eg a "similar" existing extension), that would be welcome. What I found so far and might pertain to an implementation is |
I'd prefer not to have to install Visual Studio Code in order to use it. |
I am working on a prototype of VSCode extension. The basic idea is to have an omnisharp-roslyn like backend, which takes requests then responds using stdio, and to use some utilities from omnisharp-vscode to handle the request handling in the extension. The back end (in C#) uses ILSpy support to decompile and sends nodes and decompiled code to VS Code extension for display using the TreeDataProvider and the editor. I haven't added support for Linux/OSX. I imagine it should be easy and similar to what omnisharp-vscode is doing: running them using Mono. |
We are working hard on netstandard 2.0 (/newdecompiler branch) and it should land very, very soon. That should allow .NET Core and make this a lot more streamlined across platforms (haven't checked what mssql extension is doing - Mono too?). Related #831 |
@jeremymeng at least JetBrains Rider runs ReSharper code on Mono on non-Windows platforms. So in your case, your VSCode extension can run some ILSpy code on Mono. |
@lextm I know it's workable, just haven't got time to get to that part. Also with ILSpy netstandard 2.0 work coming, Mono route might become unnecessary. Last time I checked, the biggest obstacle is CodeDOM, which I don't see in the newdecompiler any more. |
@Yardanico Oops, sorry @sbrl Indeed, my machine can't handle much load, so I don't want to have VS Code running... (Same for Wine, really, so what @asd-and-Rizzo managed is still of no use for me.) I tried to compile the |
@PoroCYon also dnSpy works great with Wine + .net runtime |
I currently use dnSpy in the terminal, running on mono, and it works just fine. (I'm not really a UI person, so maybe some of you mightn't agree.) |
@PoroCYon we are definitely not targeting low-end machines, neither on Windows (net461 will be the future min fw) nor for any other platform we might support (.NET Core itself has some requirements). The "average" ILSpy customer does have an above-average computer (as compared to Joe Average). |
@christophwille I do have a pretty good laptop (running Ubuntu 17.04), but I'm not about to install wine or VS Code just to decompile C# programs. @PoroCYon dnSpy looks good! Next time I need to do some decompiling I might use that then 😺 |
Like I said, ILSpy is not a one-size-fits-all app. However, there is no reason why multiple frontends couldn't be built, including a command line version (also interesting for automation scenarios btw). |
@christophwille Same, it's a laptop, but not the best ever (it's 6 years old), so I'd rather avoid as much bloat as possible. FYI, I'm running Parabola (rolling release). |
Please read #831 (comment) Again, the package is intended for those that want to get started with xplat netcoreapp support. @jeremymeng please test, and @andreif if you want to test for console, that would be great. |
@christophwille my project uses a copy of |
@jeremymeng: The non-UI-related code is already extracted into
|
Yeah, but there are handy helper methods for decompiling methods, fields, etc. into various languages (C#, VB, IL). They are not tied to the WPF UI, but unfortunately within the same project. |
Soon we'll prepare a small demo command-line application that uses the CSharpDecompiler class. You could use that as a starting point for your own ideas. |
We have updated https://github.com/christophwille/ilspy-console-netcoreapp/ to "wean everyone off of CSharpLanguage". As you can see in the animated GIF, it can run as a self-contained executable on Mac + it decompiles itself (being a netcoreapp this is new, something that wasn't possible last week) |
@christophwille Is there any way to get it to work without having to install |
Self-contained deployment (scd) is the farthest we will go at the moment (remember: the cmd line uses the -alpha2 package and we haven't yet reached the functionality level of the decompiler for master merge) - there are bigger fish to fry. Having said that: the future might be https://github.com/dotnet/corert |
Please note that the ilspycmd project is now officially supported in our main repo: https://github.com/icsharpcode/ILSpy/tree/master/ICSharpCode.Decompiler.Console @jeremymeng Command line and VS "proper" addin are already part of our main repo - definitely something we'd like for a VS Code addin too. |
@christophwille I planned to publish my projects to github after some cleanup. If any ideas/architecture can be reused by ILSpy team I am happy to continue contributing. |
@jeremymeng thanks. (side note: ILSpy core devs will meet for the weekend of October 12th in Bad Ischl at our annual developer days) |
I'd like to use ILSpy on Linux, if it could be run by Mono.
Mono does not support WPF and I guess it's how ILSpy GUI is built.
The text was updated successfully, but these errors were encountered: