Comparing Versions of a .NET Framework DLL Using NDepend

September 22, 2011

no comments

Following Build conference, many people may ask what is new in the .NET Framework.
Well, you could find out by examining the documentation, but then you are limited to what it covers. If you want to know ALL that is new / updated in the .NET Framework, read on..

You can use the following method to easily find the difference between .NET Framework 4.5 and its previous version, .NET Framework 4.0!

In this post I will show you how you can use the tool NDepend to compare two versions of a DLL which is part of the .NET Framework.

I’ve already done it major parts of the framework and found interesting results! Unfortunately, I don’t have the time to publish my results since I’m going out on vacation for a month. So I leave you with these instructions on how to dig easily in the right places.

 

Introduction

NDepend is a tool for static analysis of .NET code. It has many features including the ability to run both predefined and custom queries against the code base.
These queries let you evaluate the quality of the code.

Another neat feature of NDepend is the ability to compare two versions of the same DLL. This lets you see progress between different builds of your project. Note that you don’t need the actual code, you compare the actual DLLs.

Using NDepend to compare DLLs that are part of the .NET Framework is not trivial, but can be done. This post will show you exactly how.

 

Prerequisites

image

You should have NDepend on your computer, download it here.

We will compare two different versions of the file mscorlib.dll

Some assumption before we continue:

  1. The .NET Framework v4.0 version of the file resides in: C:\NET\v4.0\mscorlib.dll
  2. The .NET Framework v4.5 version of the file resides in: C:\NET\v4.5\mscorlib.dll

 

Step 1: Create an NDepend project for each version of the .NET Framework

In this section we will analyze each version of the DLL in a different project, so the following steps will be done twice. On the next step we will compare the two project results.

 

Launch NDepend and select Create Project…

image

 

Fill the fields Project Name and Location and press OK.

image

 

Select Browse… and choose the first file: C:\Net\v4.0\mscorlib.dll

image

 

Now select View Folders that contain .NET assemblies to analyze

image

 

Select the .NET Framework folders that were automatically added and remove each one of them by right-clicking and selecting Remove

image

 

Finally, click the green Play button or simply press F5 to start analyzing the DLL

image

 

When the analyze is finished you should see some statistics about the selected DLL and you will have options to manually analyzing the file. For our purpose we can simply skip this and close the application (entirely).

image

 

Now repeat these instructions to analyze the second version of your DLL. Don’t forget to remove the .NET Framework folders!

 

Step 2: Compare between the NDepend projects

In this step we will compare the two project results from the previous step.

Launch NDepend and select Compare: 2 versions of a code base

image

 

Select the projects you have created in the previous step. Make sure you put the older version on the left and the newer version on the right.

image

 

That’s it! now you can easily compare the two versions. For example, you can check which types are new in the new DLL version, or which types have changed, etc..

image

 

That’s it for now,
Arik Poznanski.

kick it on DotNetKicks.com Shout it
Add comment
facebook linkedin twitter email

Leave a Reply