Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare 2 versions of a .NET assembly?

Tags:

.net

diff

How to compare 2 versions of a compiled .NET assembly to see changes between the 2 versions? I have a library not well-documented and I need to know what has been changed between the old version and the new version.

like image 687
user433731 Avatar asked Aug 28 '10 14:08

user433731


People also ask

Can you compare DLL files?

You can even compare entire directories. This is of course if you just need to know if they're the same, since it won't show you any code.

What are the different types of .NET assemblies?

There are three types of assemblies: Private assemblies. Shared assemblies. Satellite assemblies.

What is JustAssembly?

JustAssembly ensures that you're not introducing breaking changes into your API when releasing a new version of your product.


2 Answers

In addition to Reflector, you can use NDepend to perform this task. Please note that this is a commercial software, but the site offers a free trial. Here's an online tutorial on how one can use NDepend to compare two assemblies.

like image 94
Mikael Koskinen Avatar answered Oct 06 '22 02:10

Mikael Koskinen


The tool NDepend offers many features to handle .NET code diff. Disclaimer: I am one of the developer of the tool.

The panel Search by Change is dedicated to browse assemblies code diff. Notice that:

  • You can plug to NDepend any code diff tool used by the menu Compare older and newer version of source file
  • If you don't have the source code, only the raw assemblies, there is the option Compare older and newer version disassembled with Reflector

NDepend Search by Diff Panel

Notice also in the screenshot that a CQLinq code query is generated to browse the diff.

from m in Application.Methods 
where m.CodeWasChanged() 
select new { m, m.NbLinesOfCode }

Many others default diff queries and rules are proposed by default, that will let you browse .NET code diff in a smart way.

  • Types that used to be 100% covered but not anymore
  • API Breaking Changes: Methods
  • Avoid making complex methods even more complex
  • Avoid decreasing code coverage by tests of types
  • From now, all types added or refactored should respect basic quality principles
  • Avoid transforming an immutable type into a mutable one
  • Heuristic to find types moved from one namespace or assembly to another
like image 38
Patrick from NDepend team Avatar answered Oct 06 '22 02:10

Patrick from NDepend team