NDepend–VSTS/Azure DevOps Integration–Part 01

September 30, 2018 .NET, .NET Core, .NET Framework, Azure DevOps, Best Practices, Code Analysis, Code Quality, Dynamic Analysis, Emerging Technologies, Microsoft, Static Analysis, Tools No comments

In my previous article I wrote an introductory about NDepend and how it will be useful for Agile Team to ensure code quality.

In that article we found how we can use NDepend in a developer machine. Now with this article we will familiarize ourselves in using NDepend in your build automation pipeline in your VSTS/Azure DevOps Build Agent.

There are two types of integration possible for NDepend:

  1. Directly using NDepend Package Extension from VSTS Marketplace
  2. Manual Integration using NDepend Command Line Tool. (This would provide you more control over licensing by setting up the license in your own OnPrem VSTS Build Agent.

For the interest of this article I will cover the use of VSTS Package Extension and using NDepend Build Task in VSTS Build Pipeline.

Installation of NDepend Extension for VSTS/Azure DevOps :

1.) Got to Azure DevOps Market Place:


2.) Click on Get to Install this extension in to your AzureDevOps account and follow the steps. For the demo purpose I am starting with 30 day free trial, otherwise you can go ahead and buy the full license.




3.) Now when you get back to Azure DevOps project, you can see the NDepend side menu enabled, this is where you would see the report summary of your project.


Integration NDepend into Azure DevOps Pipeline :

1.) Select “NDepend Task” and add in to Pipeline




  • You can choose to stop the build when at least one quality gate fails.
  • You also need to specify the NDepend project file customized for your project, otherwise NDepend will use their default project file configuration.  Having your own NDepend project file will provide you more control over the policies for the scan.

Queue a new Build and wait for Build to complete. Now you can see the BuildArtifacts includes all NDepend report file.


Now you go back to NDepend menu from Left side menu item in Summary Tab. This will provide you detailed view of Technical Debt in your project.






In the next article I will cover the manual integration steps.

Introduction to NDepend : Static Code Analysis Tool

June 16, 2018 .NET, .NET Core, .NET Framework, ASP.NET, Best Practices, C#.NET, Code Analysis, Code Quality, Dynamic Analysis, Emerging Technologies, Help Articles, Microsoft, Static Analysis, Tech-Trends, Tools, Tools, Visual Studio 2017, VisualStudio, Windows No comments , , , , , ,

As a developer, you always have to take the pain of getting adapted to the best practices and coding guidelines to be followed as per the organizational or industrial standards.  Easy way to ensure your coding style follows certain standard is to manually analyze your code or use a static code analyzer like FxCop, StyleCop etc. Earlier days I have been a fan of FxCop as it was free and it provides me all necessary general guidelines in terms  of improving my solution.

In this modern world of programming everything needs to be automated, as it saves time and money in terms of automating repetitive tasks and improves efficiency. This is where static code analysers coming effective.

What is Static Code Analysis?

Static program analysis is the analysis of computer software that is performed without actually executing programs, on some version of the program source code, and in the other cases, some form of the object code or intermediate compiled code .

Sophistication of static program analysis increases is based on how deep they analyze in terms of behavior of individual statements and declarations, to analyzing the entire source code.

PS: Analysis performed on executing programs is known as dynamic analysis.

In this article I will give you an overview of one such premier static code analysis tool that can be used for your daily development routine plus use it for CI integration for DevOps efficiency.


NDepend is a static analysis tool for .NET, specifically for managed code:  NDepdend supports a large number of code metrics, allowing to visualize dependencies using directed graphs and dependency matrix. It also performs code base snapshots comparisons, and validation of architectural and quality rules.

The important capabilities of NDepend are:

  • Dependency Visualization through dependency matrix and graphs.
  • Analyse and generate software quality metrics – as per the documentation it supports 82 quality metrices.
  • Declarative rule support through LINQ queries, and it is called CQLinq and comes with a large number of predefined CQLinq rules.
  • Integration support for Cruise Control.Net, SonarCube, am City. Code rules can be configured to be checked automatically in Visual Studio or during continuous integration(CI).

License: NDepend is a commercial tool with licensing options as below:

  1. Developer seats – $477 approx. / per seat.
  2. Build Machine seats  – $955 approx. / per seat.

** You could get volume discount if you bulk procure your licenses.


Once you obtained license you will able to download, is latest version available while I write this article. Extract the zip file into your local folder, you could see the different packages/executables within the package.


1.) NDepend.Console    – Command line program to execute NDepend analysis.  You would be mostly using this component on CI Build server Help

2.) NDepend.PowerTools –  Helps write your own static analyzer based on NDepend.API, or tweak existing open-source Power Tools. Help


3.) NDepend.VisualStudioExtension.Installer – To install NDepend extension as part of Visual studio


4.) VisualNDepend – Independent visual environment for managing your NDepend tasks.


Visual Tool gives you different options to choose from:

  • You can analyse a Visual Studio Solution or project.
  • Analyse .NET assemblies in a folder.




For the demo purpose our analysis target would be one of the starter project from github –  ContosoUniversity by @alimon808.



Demo: Summary Report


Demo: Application Metrics


Demo: Dependency Dashboard:


Demo: Interactive Graph


Demo: Code Matrix View


Demo: Quality Gates Summary


Demo: Rules Summary



NDepend is one of the best enterprise grade commercial static analyser seen so far.  There are Visual Studio Code Analysis, FxCop and Stylecop Analyzer tools available but they do not provide extensive level of analysis reports NDepend provides. Being a commercial tool it gives value for money for customers by what they need.  In terms of a day to day developer  or devops lifecycle, you can integrate NDepend in your build process, which could be simple as executing the NDepend Console and reviewing the output. With NDepend’s API it is easy to develop your own custom analysis tools based on CQLinq and NDepend.PowerTools(which is open source). You could find all the detailed help in NDepend documentation.


Upcoming Webinars and Trainings on Microsoft Technologies(Windows 8, Windows Phone 8, Windows Azure, HTML5) – Feb 2013

February 12, 2013 .NET, All, ASP.NET, ASP.NET MVC, Azure, Channel9, Community, JavaScript, JumpStarts, KnowledgeBase, Microsoft, Microsoft SDKs, Mobile-Development, MSDN, MVA, Recommends, Tech Newz, Training-Kits, Web API, Webinars, Windows, Windows 8 apps development, Windows Azure, Windows Azure Development, Windows Phone, Windows Phone 7.1 SDK, Windows Phone 7.8, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Phone Store, Windows Store Development, Windowz Azure No comments

Jump Start – February 19: Building Web Apps with ASP.NET (February 19)
An accelerated introduction to building modern web applications with ASP.NET 4.5 and ASP.NET MVC 4 team-taught by Scott Hanselman and Jon Galloway.

Windows Azure Hands-on Labs Online Training (February 20)
Learn how to connect a Paas application to an Iaas application. Matt Hester will be available to help you work through configuring a simple web app, publish to Windows Azure, and run it in the cloud. Download the free Azure 90-day trial for the hands-on portion of this training.

Jump Start – February 21: Building Apps for Windows 8 and Windows Phone 8
Compare and contrast Windows 8 and Windows Phone 8 with an eye to understanding how to maximize the code you reuse when building for both platforms. Dive into guidance, best practices, patterns, and techniques that will help you deliver apps with maximum code reuse.

Jump Start – – February 28: Advanced Windows 8 App Development Using JavaScript
Join Jeremy Foster and Michael Palermo for a free Jump Start on optimizing and supporting Windows Store apps. It’s a fast-paced course for experienced developers that can help you prepare for Microsoft Certification Exam 70-482: Advanced Windows Store App Development Using HTML5 and JavaScript.


Watch the previous jump start series:

Building Your Windows 8 Apps with XAML and Blend
Jerry Nixon welcomes Navit Saxena and Hari Menon from the Microsoft Blend team to discuss the latest features and improvements made in Blend as it pertains to XAML developers and its integration with Visual Studio 2012. Tune in to hear how Blend can make life much easier for Windows 8 app developers. Get 30 days of free help to build your own app – sign up today at Generation App.

Create Windows Store Apps with HTML5 and JavaScript
This quick, step-by-step article includes code samples for how to create Windows Store apps with HTML5 and JavaScript.

Training Guide: Programming in HTML5 with JavaScript and CSS3
Are you getting ready to take Microsoft Certification Exam 70-480: Programming in HTML5 with JavaScript and CSS3? Buy the ebook version of the new Training Guide and start getting chapters early.


[Courtesy: Channel9, MSDN Flash, Microsoft Virtual Academy(MVA) , Microsoft]

Windows Phone 8–Application Model & Fast Application Resume feature

February 4, 2013 .NET, .NET Framework, All, Community, Microsoft, Microsoft SDKs, MSDN, VisualStudio, Windows Phone, Windows Phone 7.1 SDK, Windows Phone 7.5, Windows Phone 7.8, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Phone Store No comments

Windows Phone 8 has a new feature introduced called as ‘Fast Application Resume’, which allows the Windows Phone 8 OS to launch the application from suspended to running quickly. You feel like toggling between multiple apps with out much delay comparing to Windows Phone 7.x platform.

With Windows Phone 7.5, OS was allowed to move the applications to Suspended/Dormant state, if another application is launched or currently running. This allows only one application can be running in the foreground at a time, and other applications you launched previously will be put on Suspended/Dormant mode.  You can bring back the previously running applications(that is currently in suspended/dormant mode), by selecting the app from the Task Switcher(press and hold – <back button for few seconds to display all list of suspended apps in memory).

The following diagram explains the application life cycle of a Windows Phone application:

Windows Phone 7.x – Application Lifecycle 

Win 7 Mango - Lifecycle.png

[Image Courtesy: Nokia Developer]


A simple diagram: that explains how the application lives and dies in Windows Phone app

State diagram showing transitions between app execution states

[Image courtesy: Microsoft]

For more information on the lifecycle of a Windows Phone app see App activation and deactivation for Windows Phone.

How is it different in Windows Phone 8.0


[Quoting from – MSDN]

On Windows Phone 8, when the user navigates away from an application, the application is suspended and its state is preserved in memory. If the user returns to the application by pressing the Back button or by using the Task Switcher, the app instance resumes. Because the app was preserved in memory, the app quickly resumes in the same state it was when the user navigated away. This process is called Fast App Switching (FAS).

By default(on both Windows Phone 7.x and Windows Phone 8.0 platform) – If the app is suspended and the user relaunches the app, such as by tapping on the app name in the app list or tapping the app’s primary Start Tile, by default the old instance of the app is terminated and a brand new instance of the app is created. This process is slower than resuming a suspended app and provides a different user experience. This is scenario as Windows Phone 7.x.

Windows Phone 8 introduces the ability for apps to request that user actions that would typically relaunch the app, such as tapping the app’s Start Tile, instead resume the suspended instance of the suspended app instance, if one exists. This feature is called Fast Resume.


To Enable the Fast Application Resume in your Windows Phone 8 applications – you can do it by adding an option(ActivationPolicy=”Resume”) in app manifest file(WMAppManifest.xml)

See how you can do it in visual studio:


Code block:

<DefaultTask Name="_default" NavigationPage="MainPage.xaml" ActivationPolicy="Resume"/>

Sounds Cool! right – this can improve your application performance in Windows Phone 8, while toggling between different apps.

For more information on the Fast Application Resume Fast app resume for Windows Phone 8.


The Application Execution Model in Windows Phone 7.5 by Daniel Vaughan

MSDN – App activation and deactivation for Windows Phone

MSDN – Fast app resume for Windows Phone 8

Execution Model Overview for Windows Phone

Windows 8 Client Hyper-V and Windows Phone 7.x emulator slowdown

January 28, 2013 .NET, All, Community, Hyper-V, KnowledgeBase, Microsoft, Mobile-Development, MSDN, Tips & Tricks, VisualStudio, VS2010, VS2012, Windows, Windows 8, Windows Phone, Windows Phone 7.0, Windows Phone 7.1 SDK, Windows Phone 7.5, Windows Phone 7.8, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Phone Store No comments

Hyper-V is a great platform for virtualization and luckily Windows 8 have inbuilt/integrated support for hyper-v technologies. Windows Phone 8 SDK uses hyper-v for emulator virtualization and it works pretty good with Visual Studio 2012. Hyper-V integrated to the Windows 8 is been called ‘Client Hyper-V’.

Client Hyper-V is the same virtualization technology previously available only in Windows Server®. A similar functionality in Windows 7 is called Windows XP Mode. Client Hyper-V enables you to run more than one 32-bit or 64-bit x86 operating system at the same time on the same host computer. But instead of working directly with the computer’s hardware, the operating systems run inside a virtual machine (VM). Hyper-V enables developers and IT professionals to easily maintain multiple test environments and provides a simple mechanism to quickly switch between these environments.

You can read more about it from MSDN Guide – Using Windows 8 Client Hyper-V


The problem is – Client Hyper-V have some inconsistencies with old Windows Phone 7.x emulators. The new Windows Phone 7.8 emulators works fine, but with older Windows Phone 7.x emulators you could experience the slow start-up/load of the emulator. It takes few minutes to launch in some systems, and in some high end multi core systems it launches in moments.

You will experience this problem when you want to develop and test for old Windows Phone 7.x devices, you will have problem in launching emulators.

From my experience and searching on Google the following thread help me to understand that it is a known problem with Windows 8 – Hyper-V and Windows Phone 7.x emulators. If you turn off Hyper-V for a while you can experience that Windows Phone 7.x emulators are launching instantly when you launch for debug/run. 

So here is the dilemma scenario,

You want to develop an application that you want to test on both Windows Phone 7.x and Windows Phone 8.0 emulators


You want to develop and application targeting Windows Phone 7.x using Visual Studio 2010 in Windows 8.


I have few steps to follow to toggle between the development environment, and depending on the system it is time taking, or little annoying – but we have to deal with it.

So I have to disable Hyper-V when I have to work on Windows Phone 7.x emulator.

Disable Hyper-V feature

Control panel -> Programs and Features -> Turn windows features on or off -> Uncheck Hyper-V feature.


Restart the machine.

NB: Enabling/Disabling Hyper-V will require you to restart to take effect.

But this is a time taking process and every time you will have to On/Off feature and restart. What we could have an option in Windows Boot itself – through which I can normally boot to Windows with Hyper-V or boot with Hyper-V disabled.

We can do that using hypervisorlaunchtype = off/on boot flag. 

An easy fix for this is to create a second boot entry for my system that starts Windows without starting the hypervisor.  To do this you need to open an administrative command prompt and run the following commands(follow steps below):


1. bcdedit /copy {current} /d "Windows 8 – no hypervisor"

This copies your currently active boot entry (assuming that this is the one you want to copy or select the appropriate one – if you are on a multi-boot environment) and gives the new copy the name you mentioned above ‘Windows 8 – no hypervisor’.

this will display a message in command prompt that “The entry was successfully copied to {some guid_identifier}”


2. bcdedit /set {guid_identifier} hypervisorlaunchtype off

guid_identifier is the identifier for the new boot entry (copy from the output of a plain ‘bcdedit’ command – we executed in step 1)} ,

Copy the {guid} from the command prompt window and run the above command appropriately replacing {guid_here} with {guid from your command window for the new boot entry}


Now you have an additional boot entry, you can login in to your Windows 8 with hyper-v disabled mode and when you are done with it – You can reboot and select your default boot option(which is with Hype-V enabled).

1. When you want to work with Windows Phone 8.0 emulators select default boot option from boot menu.

2. When you want to work with Windows Phone 7.x emulators – select the newly created boot option from boot menu.

Hope that helps some of you – who worried with these kind of troubles with Windows Phone development.

Note: Some of you with kind of powerful systems will less experience these kind of issues. So this tip is for those who are in need. Smile

Making an Offline install of Windows Phone SDK update for Windows Phone 7.8

January 26, 2013 .NET, All, Community, KnowledgeBase, Microsoft, Microsoft SDKs, MSDN, Tips & Tricks, Windows Phone, Windows Phone 7.1 SDK, Windows Phone 7.8, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK 2 comments

In my last articles I introduced you to the latest update for Windows Phone SDK to support Windows Phone 7.8. The installer available download from here, the installer package[WPExpress78_update.exe](1.10MB) is an Online/Web Installer – will download the necessary packages on demand at the time of installation, and it would take some time depending on your bandwidth.

I was looking for ways I can have all the packages pre downloaded and available offline for my later installations.I came across some quick tips, and it may useful to you all as well.

We can do it easily using the ‘/Layout’ switch/command line argument available in Setup executable.

Follow the steps below:

1. Open your ‘Command Prompt’ with Administrator privileges (Right click on ‘Command Prompt’ icon and click on ‘Run as Administrator’ from context menu – which will launch ‘Command Prompt’ with Administrator privileges.).

2. Navigate to the command terminal to the folder in which WPExpress78_update.exe is stored. In my case it is ‘C:\Downloads’.

3. Type the following command in the Command Prompt

WPExpress78_update.exe /layout

/layout switch will create a copy of the media in the specified folder.

This will launch  the installer and prompt you for the Download location, to download and store the packages.

4. Specify the  target folder to store the extracted/downloaded package files, and click on ‘Download’ button.


Sit and relax – the setup will start download. It will take a while in acquiring necessary packages.


You can see a ‘Packages’ folder created inside your target folder and a copy of ‘WPExpress78_update.exe’ placed with it.


Packages folder contains only two updates. Windows Phone 7.1.1 update and Windows Phone 7.8 emulator images.


5. Wait for a while and download will complete. Once download is completed you can install the update by Clicking on ‘WPExpress78_update.exe’ from the target folder.


Now you have the complete packages available offline and can install whenever you want. Or keep a backup of the full folder. 

Hope you enjoy reading the article.