使用ildasm获取源代码_有什么比ILDasm好? ILSpy和dnSpy是反编译.NET代码的工具
使用ildasm獲取源代碼
.NET code (C#, VB, F#, etc) compiles (for the most part) into Intermediate Language (IL) and then makes it way to native code usually by Just-in-time (JIT) compilation on the target machine. When you get a DLL/Assembly, it's pre-chewed but not full juiced, to mix my metaphors.
.NET代碼(大部分是C#,VB,F#等)會編譯為中間語言(IL),然后通常通過在目標計算機上進行即時(JIT)編譯將其轉換為本地代碼。 當您獲得DLL /程序集時,將其進行預咀嚼但未完全溶解,以混合我的隱喻。
Often you'll come along a DLL that you want to learn more about. Sometimes you'll want to just see the structure of classes, methods, etc, and other times you want to see the IL - or a close representation of the original C#/VB/F#, etc. You're not looking at the source, you're seeing a backwards projection of the IL as whatever language you want. You're basically taking this pre-chewed food and taking it out of your mouth and getting a decent idea of what it was originally.
通常,您會遇到想要了解更多信息的DLL。 有時,您只想看一下類,方法等的結構,而有時又想看一下IL-或原始C#/ VB / F#的近似表示,等等。您不是在看源代碼。 ,無論您想要哪種語言,您都會看到IL的向后投影。 您基本上是在將這種預先咀嚼的食物從嘴里拿出來,對它的原味有個不錯的了解。
I've used ILDasm for years, but it's old and lame and people tease you for using it because they are cruel. ;)
我已經使用ILDasm多年了,但是它又老又la腳,人們嘲笑您使用它,因為它們很殘酷。 ;)
Seriously, though, I use ILDasm - the IL Disassembler - simply because it's already installed. Those tweets got me thinking though that I need to update my options, so I'm trying out ILSpy and dnSpy.
嚴重的是,我使用ILDasm-IL Disassembler-僅僅是因為它已經安裝了。 這些推文讓我開始思考,盡管我需要更新我的選項,所以我正在嘗試ILSpy和dnSpy 。
ILSpy (ILSpy)
ILSpy has been around for a while and has multiple front-ends, including ones for Linux/Mac/Windows based on Avalonia in the form of AvaloniaSpy. You can also integrate ILSpy into Visual Studio 2017 or 2019 with this extension. There is also a console decompiler and, interestingly, cross-platform PowerShell cmdlets.
ILSpy已經有一段時間,有多個前端,包括基于Avalonia尼亞用于Linux / Mac的/ Windows的那些AvaloniaSpy的形式。 您還可以使用此擴展將ILSpy集成到Visual Studio 2017或2019中。 還有一個控制臺反編譯器,以及有趣的是跨平臺的PowerShell cmdlet 。
I've always liked the "Open List" feature of ILSpy where you can open a preconfigured list of assemblies you want to browse, like ASP.NET MVC, .NET 4, etc. A fun open source contribution for you might be to update the included lists with newer defaults. There's so many folks doing great work in open source out there, why not jump in and help them out?
我一直很喜歡ILSpy的“打開列表”功能,您可以在其中打開要瀏覽的程序集的預配置列表,例如ASP.NET MVC,.NET 4等。對您來說,一個有趣的開源貢獻可能是更新包含的列表具有較新的默認設置。 有這么多人在開源方面做得很好,為什么不跳進來幫助他們呢?
dnSpy (dnSpy)
dnSpy has a lovely UI AND a great Console app using the same engine. It's amazingly polished and VERY complete. I was surprised that it also has a full hex editor as well as property pages for common EXE file headers. From their GitHub, dnSpy features
dnSpy具有漂亮的用戶界面和使用相同引擎的出色控制臺應用程序。 它非常拋光,非常完整。 我很驚訝它還具有完整的十六進制編輯器以及常見EXE文件標頭的屬性頁。 從GitHub的dnSpy功能
- Debug .NET Framework, .NET Core and Unity game assemblies, no source code required 調試.NET Framework,.NET Core和Unity游戲程序集,無需源代碼
- Edit assemblies in C# or Visual Basic or IL, and edit all metadata 編輯C#或Visual Basic或IL中的程序集,并編輯所有元數據
- Light and dark themes 淺色和深色主題
- Extensible, write your own extension 可擴展,編寫自己的擴展
- High DPI support (per-monitor DPI aware)高DPI支持(每個監視器都知道DPI)
dnSpy takes it to the next level with an integrated Debugger, meaning you can attach to a running process and debug it without source code - but it feels like source code because it's decompiling for you. Note where it says C#, I can choose C#, VB, or IL as a "view" on my decompiled code.
dnSpy通過集成的調試器將其提升到一個新的水平,這意味著您可以附加到正在運行的進程中,而無需源代碼即可對其進行調試-但這就像源代碼,因為它正在為您反編譯。 請注意,在顯示C#的地方,我可以選擇C#,VB或IL作為反編譯代碼上的“視圖”。
Here is dnSpy actually debugging ILSpy and stopped at a decompiled breakpoint.
這是dnSpy實際上正在調試ILSpy并在反編譯的斷點處停止的情況。
There's a lot of great low-level stuff in this space. Another cool tool is Reflexil, a .NET Assembly Editor as well as de4dot by the same mysterious author as dnSpy. JetBrains has the excellent dotPeek and Telerik has JustDecompile. Commercial Tools include Reflector.
在這個空間中,有很多很棒的底層東西。 另一個很酷的工具是.NET程序集編輯器Reflexil,以及與dnSpy一樣神秘的作者的de4dot。 JetBrains具有出色的dotPeek,而Telerik具有JustDecompile 。 商業工具包括Reflector 。
What's your favorite?
你最喜歡什么?
Sponsor: Manage GitHub Pull Requests right from the IDE with the latest JetBrains Rider. An integrated performance profiler on Windows comes to the rescue as well.
贊助商:使用最新的JetBrains Rider從IDE直接管理GitHub Pull Requests。 Windows上的集成性能分析器也可以解決。
翻譯自: https://www.hanselman.com/blog/whats-better-than-ildasm-ilspy-and-dnspy-are-tools-to-decompile-net-code
使用ildasm獲取源代碼
總結
以上是生活随笔為你收集整理的使用ildasm获取源代码_有什么比ILDasm好? ILSpy和dnSpy是反编译.NET代码的工具的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2019年3月未来教育计算机二级题库,2
- 下一篇: 计算机控制课程设计体会,计算机控制技术课