DCSIMG
September 2011 - Posts - Arik Poznanski's Blog

Arik Poznanski's Blog

It CAN be done with .NET

News

MVP

MCC

CodeProject MVP

MCPD

MCTS

Subscribe to my blog by email

Arik Poznanski LinkedIn Profile

Email: arik.com at gmail dot com
or, use this form

Locations of visitors to this page


Sela Group

Sela Canada

DZone MVB

Links

Official Blogs

WPF / SL Blogs

Developers Blogs

September 2011 - Posts

Comparing Versions of a .NET Framework DLL Using NDepend

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

Windows 8: What's New?

Got back from Build conference. Since I expect many people will ask me "So, what's new?" and since the answer is rather complex, I figured I should try to write a post about it, so here goes…

build_logo

 

General Information

  • Windows 7 sold (i.e. legal copies) over 450,000,000 copies since it was released.
  • Windows 7 bypassed Windows XP in world usage.
  • Windows 8 will be used primary for tablets and other touch-based devices.
  • Windows 8 can run on Intel-based processors or ARM-based processors.
  • Windows 8 consumes fewer resources than Windows 7 and has the same hardware requirements.
  • Windows 8 has a new user interface, used primarily with touch screens but supports fallback to mouse and keyboard, applications that uses the new user interface are called "Metro-style applications".
  • All participants of the Build conference received a Samsung tablet with a preview release of Windows 8, that has the following spec:
    • Intel Core i5
    • 4GB DDR3
    • 64GB SSD
    • 11.6" diagonal, 1366x768 display
    • Included dock and USB keyboard
  • Windows 8 Developer Preview version can be downloaded here.

 

Windows 8 for Developers

  • There is a new way to expose Windows API named Windows Runtime or WinRT.
    • WinRT is completely native and is built above COM with the addition of inheritance, generics, delegates and more. Basically WinRT = Modern COM.
    • WinRT doesn't cover all previous Win32 APIs.
    • WinRT has can be used from C++, C#, VB.NET and JavaScript using language projections which are auto-generated from the WinRT APIs and provide a natural and familiar experience for developers of the language.
    • WinRT API follow a guideline that says that every API which might take more than 50ms should be async. As a result a lot of WinRT APIs are async.

 

windows-8-platform-tools

  • WinRT includes a native UI framework, XAML-based, for building Metro-style applications.
  • The XAML of the new WinRT UI framework resembles Silverlight XAML rather than WPF XAML.
  • Metro-style applications can be built in the following technologies:
    • C++ and XAML
    • C# and XAML
    • VB.NET and XAML
    • JavaScript and HTML/CSS
  • A Metro-style application can collaborate with another Metro-style application without knowing him at all using several contracts that Windows 8 defines, e.g. share source contract and share target contract.
  • Metro-style applications should define the capabilities they use, similar to Windows Phone applications. At runtime these declarations are enforced.
  • C++ has new extensions that allows easy integration with WinRT, these extensions follow a syntax similar to C++/CLI, only they are completely native.
  • The next version of .NET Framework is 4.5, nothing too exciting there.

 

IDE Improvements

  • There is a preview version Visual Studio 11 and Expression Blend 5.
  • New in Visual Studio 11:
    • Added new project templates for developing Metro-style applications in all the supported languages.
    • Productivity Power Tools incorporated into Visual Studio 11.
    • New features for agile development including: Sprint Planning, Managing Task Board, Performing Code Reviews.
    • XAML properties editor is the same as the corresponding Blend editor.
    • Deploy to the new Windows App Store directly from Visual Studio 11.
    • Added tools for viewing and basic editing 3D models, images, textures and also for debugging DirectX based output.
    • Added feature that allows searching for code duplication based on semantic tree instead of simple text search.
  • New in Expression Blend 5:
    • Designing Metro-style HTML / CSS applications.
  • TFS will be available as a service on the cloud.

 

Some General Insights:

  • C++ is very much alive! I've been to an excellent lecture on modern C++ (the portable one, not MS specific), by Herb Sutter. Wow. So many C++ developers, the room was packed!
  • Future of Silverlight is not clear. There will be version 5 but there's no information about what's next.

Since all the videos are now available on the conference site, I strongly suggest you see the ones that are interesting for you. Note that there quite a lot.

That's it for now,
Arik Poznanski.

kick it on DotNetKicks.com Shout it

WPF Tutorial Published [HEB]

After publishing a Windows Phone tutorial and a Silverlight tutorial, I now bring you the WPF tutorial, for the sake of XAML-based technology completeness.

This 37 chapters tutorial in Hebrew completely adapted to fit WPF desktop development and using relevant source code and screenshots.

The tutorial is hosted on the great Hebrew developers community site: WebMaster.org.il

The tutorial is based on WPF 4 and it teaches desktop development from the first step, using Visual C# 2010 Express, provided freely by Microsoft.

image

Following is the index for all chapters:

    1. Introduction & Working Environment
    2. First Application
    3. XAML Language
    4. Setting Properties in XAML
    5. XAML and Code-behind C#
    6. Layout: Introduction
    7. Layout: Using StackPanel & WrapPanel
    8. Layout: Using DockPanel
    9. Layout: Using Grid
    10. Layout: Using Canvas
    11. Layout: Additional Properties
    12. Basic Controls: Introduction
    13. Basic Controls: Button controls
    14. Basic Controls: Text Controls
    15. Basic Controls: ListBox
    16. Basic Controls: ComboBox
    17. More Controls
    18. Date Controls
    19. Menu Controls
    20. Understanding ContentControl
    21. Using Dependency Properties
    22. Using Routed Events
    23. Adding Child Windows
    24. Using Resources
    25. Data Binding: Introduction
    26. Data Binding: Controlling Information Flow
    27. Data Binding: Controlling Update Time
    28. Data Binding: Defining Sources
    29. Data Binding: Using IValueConverter
    30. Data Binding: Using INotifyPropertyChanged
    31. Data Binding: Binding to Collections
    32. Using Data Templates
    33. Using Shapes
    34. Using Brushes
    35. Displaying Images and Videos
    36. Using Transformations
    37. Using Styles

     

    That's it for now,
    Arik Poznanski.

    kick it on DotNetKicks.com Shout it