10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macOSでC#の逆コンパイル

Posted at

Windowsだと色々手段があるようですが、macOSでさくっとC#の逆コンパイルをする情報があまりなかったので、手順をまとめてみます。
ILSpyというオープンソースの.Netアセンブリのデコンパイラを利用します。

##手順

###1. .Net SDKのインストール
下記ページから.Net SDKをダウンロードして、インストーラを起動してインストール
https://www.microsoft.com/net/learn/get-started/macos

# シンボリックリンク
$ ln -s /usr/local/share/dotnet/dotnet /usr/local/bin

# 確認
$ dotnet -h
.NET Command Line Tools (2.1.200)
...

###2. ILSpyのインストール

$ git clone https://github.com/icsharpcode/ILSpy.git

$ cd ILSpy/ICSharpCode.Decompiler.Console/

# ビルド
$ dotnet publish -c release -r osx-x64

$ cd bin/release/netcoreapp2.0/osx-x64/publish/

# 実行権限をつける
$ chmod +x ilspycmd

$ cp -r ../publish/ /usr/local/opt/ilspycmd

$ ln -s /usr/local/opt/ilspycmd/ilspycmd /usr/local/bin/

# 確認
$ ilspycmd -h

###3. 実行

$ ilspycmd test.exe

逆コンパイルできた:tada:

環境

macOS Sierra 10.12.5

参考

https://github.com/icsharpcode/ILSpy/tree/master/ICSharpCode.Decompiler.Console
https://qiita.com/koki_cheese/items/727577ab830a44050dcc

10
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?