Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Assembly Diff / Compare Tool - What's available? [closed]

Tags:

I'd like to be able to do a code-level diff between two assemblies; the Diff plug-in for Reflector is the closest thing I've found so far, but to compare the entire assembly is a manual process requiring me to drill-down into every namespace/class/method.

The other tools I've found so far appear to be limited to API-level (namespaces, classes, methods) differences--which won't cut it for what I'm looking for.

Does anyone know of such a tool? My requirements (from highest to lowest) are:

  • Be able to analyze / reflect the code content of two versions of the same assembly and report the differences
  • Accept a folder or group of assemblies as input; quickly compare them (similar to WinMerge's folder diff's)
  • Quick ability to determine if two assemblies are equivalent at the code level (not just the API's)
  • Allow easy drill-down to view the differences
  • Exporting of reports regarding the differences

(Personally I like WinMerge for text diffs, so an application with a similar interface would be great)

like image 330
STW Avatar asked Aug 14 '09 21:08

STW


People also ask

What is JustAssembly?

JustAssembly is a lightweight . NET assembly diff and analysis tool built on top of the Telerik JustDecompile Engine. As opposed to just comparing signatures, it produces a diff on all assembly contents including the code of the methods.

What is .NET assembly explain its types?

In the Microsoft . NET framework, an assembly is a partially compiled code library for use in deployment, versioning and security. There are two types: process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. .

What is current assembly in C#?

It is basically a compiled code that can be executed by the CLR. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An Assembly can be a DLL or exe depending upon the project that we choose.

What is default type of dotnet assembly?

By default, assemblies are private. A private assembly is used only by a single application, and is stored in application folder, or in a subfolder. When the . net code gets compiled it generates an assembly which is stored in bin folder.


3 Answers

The tool NDepend offers many features to handle .NET code diff.

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

enter image description here


Many code rules that constraint diff and evolution are proposed. They can be a good start to write your own ones or adapt them to your needs. For example look at the rule:

Types that used to be 100% covered but not anymore

// <Name>Types that used to be 100% covered but not anymore</Name>
warnif count > 0
from t in JustMyCode.Types where 
   t.IsPresentInBothBuilds() &&
   t.OlderVersion().PercentageCoverage == 100 &&
   t.PercentageCoverage < 100
let culpritMethods = t.Methods.Where(m => m.PercentageCoverage < 100)
select new {t, t.PercentageCoverage, culpritMethods }

or also:

  • 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

To get started with NDepend compare capabilities, have a look at the documentation:

  • Advanced Code Diff from within Visual Studio: explains how to use the NDepend build comparison features, in the context of Visual Studio and Visual NDepend standalone UI.

  • Reporting Code Diff: explains how to use the NDepend build comparison features, in the context of reporting.

Disclaimer: I work for NDepend

like image 68
Patrick from NDepend team Avatar answered Oct 01 '22 08:10

Patrick from NDepend team


ILSpy can decompile an assmembly out to a tidy directory structure. Do this for each of your assemblies and you can use a diff tool of your choice to see what has changed.

like image 20
David Peters Avatar answered Oct 01 '22 10:10

David Peters


You can use ILDasm to generate il source from an assembly. IL source is basically a text file, so you can compare two il files using standard text diff tools. Interpreting the IL sources may not necessary, if you use the reported diffs as an indication where to look further.

like image 27
oɔɯǝɹ Avatar answered Oct 01 '22 09:10

oɔɯǝɹ