.net 用于比较 .dll 和反汇编差异的工具?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/590863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tool to compare .dlls and disassemble the differences?
提问by flesh
Does anyone know a decent tool that will compare two different versions of the same dll and extract the differences?
有谁知道一个不错的工具可以比较同一个dll的两个不同版本并提取差异?
thanks
谢谢
采纳答案by Andrew Hare
回答by Colin Mackay
dotPeekfrom JetBrains can also be used. It is also free.
也可以使用 JetBrains 的dotPeek。它也是免费的。
- Open the assembly up in dotPeek
- Select the assembly
- File --> Export to project
- Choose a location on disk
- 在 dotPeek 中打开程序集
- 选择装配
- 文件 --> 导出到项目
- 在磁盘上选择一个位置
Repeat the above for the assembly you want to compare, then open the two folders in a diff tool. I used WinMerge.
对要比较的程序集重复上述操作,然后在差异工具中打开两个文件夹。我使用了WinMerge。
You'll notice that the vast majority of files have differences. This is because the files have a comment at the top like this
您会注意到绝大多数文件都存在差异。这是因为文件顶部有这样的注释
// MVID: {some guid here}
or
或者
// Assembly location: {some path here}
You can create a filter in WinMerge to ignore it
您可以在 WinMerge 中创建一个过滤器来忽略它
- Tools --> Filter...
- Goto the "Line Filters" tab
- Add the following filter
^// MVID: - Add the following filter (optional)
^// Assembly location: - Check the checkbox next to your new Regular Expression
- Check the "Enable Line Filters" checkbox
- 工具 --> 过滤器...
- 转到“线路过滤器”选项卡
- 添加以下过滤器
^// MVID: - 添加以下过滤器(可选)
^// Assembly location: - 选中新正则表达式旁边的复选框
- 选中“启用线路过滤器”复选框
When you okay the changes, it will rescan the folders and ignore any line that starts with that comment. Now you should see just the changes you're interested in.
当您同意更改时,它将重新扫描文件夹并忽略以该注释开头的任何行。现在您应该只看到您感兴趣的更改。
回答by karlipoppins
回答by theChrisKent
Use .NET Reflector(Free version is all you need) to open the dlls then right-click and choose to export them to separate directories.
使用.NET Reflector(您只需要免费版)打开 dll,然后右键单击并选择将它们导出到单独的目录。
Then use ExamDiff Proto compare the directories (You can get a 30-Day free trial). You can navigate through the sub folders and open each file as necessary into a new Comparison window (Just double-click in the ExamDiff Pro Window). Works awesome!
然后使用ExamDiff Pro比较目录(您可以获得 30 天免费试用)。您可以浏览子文件夹并根据需要在新的比较窗口中打开每个文件(只需在 ExamDiff Pro 窗口中双击)。 作品很棒!
ExamDiff Pro also has a Dump PE32 plugin that will do a comparison directly between .dll and .exe files. This is helpful to look at header changes and flags binary differences, but will not decompile it for you (so use the Reflector method above).
ExamDiff Pro 还有一个 Dump PE32 插件,可以直接在 .dll 和 .exe 文件之间进行比较。这有助于查看标头更改和标记二进制差异,但不会为您反编译(因此请使用上面的 Reflector 方法)。
回答by sharptooth
Why not disassemble first and then compare?
为什么不先拆开再比较呢?
回答by benthemos
The Microsoft BCL team have a tool do to this, it's called LibCheck and can be found here
Microsoft BCL 团队有一个工具可以做到这一点,它叫做 LibCheck,可以在这里找到
http://blogs.msdn.com/b/bclteam/archive/2005/03/21/400123.aspx
http://blogs.msdn.com/b/bclteam/archive/2005/03/21/400123.aspx
This is an old tool, and I had to recompile the source using a later version of the runtime, but it works well and provide html reports on changes.
这是一个旧工具,我不得不使用更高版本的运行时重新编译源代码,但它运行良好并提供有关更改的 html 报告。

