36

I need to decompile a small application written in .NET and convert it to C++. I don't have Windows installed and I know there're a number of .NET decompilers for Windows. Since I have only Mac and Linux and don't want to install Windows only to be able to run a decompiler, I wonder, is there any easy way to decompile a .NET application in Mac or Linux? I searched for it and didn't find anything.

2

4 Answers 4

18

Since most of the parts of .NET is open-sourced, ILSpy also works with Linux and Mac.

From project GitHub page:

Decompiler Frontends

Aside from the WPF UI ILSpy (downloadable via Releases, see also plugins), the following other frontends are available:

  • Visual Studio 2017/2019 extension marketplace
  • Visual Studio Code Extension repository | marketplace
  • ICSharpCode.Decompiler NuGet for your own projects
  • Linux/Mac/Windows ILSpy UI based on Avalonia - check out https://github.com/icsharpcode/AvaloniaILSpy
  • Linux/Mac/Windows command line client - check out ICSharpCode.Decompiler.Console in this repository
  • Linux/Mac/Windows PowerShell cmdlets in this repository

Since VS Code works with Linux and Mac, that front end should work in those operating systems too. Command line client should also work.

In addition, JetBrains has a new IDE for .NET, Rider. It works in Linux and Mac. Rider has a built-in decompiler. Unfortunately, this built-in compiler, dotpeek, was only available for Windows. But according to comments, dotpeek works in Mac as of 2023 Summer.

Another choice is to use mono decompiler, a tool from monoproject. Try to use it. Note that this is an add-in in MonoDevelop.

3
  • 1
    doesn't mono have to be installed?
    – Incerteza
    Dec 11, 2014 at 1:27
  • crash again and again. Aug 1, 2021 at 17:34
  • 1
    JetBrains Rider's built in decompiler works for Mac now. (I tested it on M2 Macbook Air)
    – Kye
    Sep 6 at 12:58
12

There's a variant/fork of ILSpy using Avalonia which is available as a packaged MacOS app.

Download from https://github.com/icsharpcode/AvaloniaILSpy/releases

There are instructions for whitelisting the package (which is unsigned) on the page, e.g.:

enter image description here

1
  • 5
    Thank you! If there is an error on launch, run this command chmod +x "/Applications/ILSpy.app/Contents/MacOS/ILSpy"
    – pnavk
    Sep 14, 2020 at 19:23
0

There is monodis in command line disassembler for IL in Mono. It is possible to use it on Linux and macOS even if you already work with .NET 5 or 6. However you have to install Mono.

-4

You can decompile an EXE using built-in facilities within Visual Studio for Mac [if you are on OSX].


Here's a step by step walkthrough post I wrote!

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.