Code Metrics Viewer 2015 is available for download

I am a man of few words… a new extension package is out now that integrates the Code Metrics Power Tool for Visual Studio 2015 into Visual Studio 2015 (requires Update 1). It provides the exact same functionality as it´s predecessor targeting Visual Studio 2013, except for a minor fix required to make themes work properly, since the way the IDE stores information about the currently selected theme had slightly changed…

Published: Code Metrics Viewer 2012

I published updates of all my Visual Studio Gallery contributions. Actually, there´s no new functionality in there, just minor changes, a few bug-fixes and updated references to third-party libraries. I changed the names of the tools a bit; “Code Metrics Viewer” has been renamed to “Code Metrics Viewer 2010” and the pre-release of “Code Metrics Viewer 2” is now named “Roslyn Metrics“, which makes more sense since I created the Code Metrics Viewer 2012 extension that integrates the Code Metrics Power Tool 11.0 into Visual Studio 2012.

As I wrote in my last post, the Code Metrics Power Tool 11.0 does not have a setup… but don´t worry (-: After you´ve installed the Code Metrics Viewer 2012 extension, just open the Options dialog, navigate to Code Metrics, then Tools – and click the “Download and Install…”-button. This will download the Power Tool from http://bit.ly/11b4mqX and extract it to the local FxCop-directory. If you´re interested in how the setup routine works, you can take a look at the code that I published on Github…

Code Metrics Viewer 2012 Options Dialog

New release: Version 1.6.0

I migrated the WPF user interface (that I had implemented for Code Metrics Viewer 2) to the Visual Studio 2010 extension in order to address some user interface issues which have been requested by users many times. Now, the grid allows to scroll horizontally, allows to change the position of grid columns and icons have been added to namespace-, type- and member- nodes. I also removed the modal progress dialog – and added an indeterminate progress indicator to the tool window instead. The toolbar is now a native Visual Studio toolbar that uses the blue theme…

code-metrics-viewer-window-2

Code Metrics Viewer 2 CTP

I published a pre-release version of the Code Metrics Viewer 2 extension targeting Visual Studio 2012. It´s the continuation of my first contribution, but it works completely differently. The first version was just a user-interface that integrated the Code Metrics Power-Tool 10.0 into the development environment, but the new version brings its own calculation functionality – and instead of analyzing IL it acts on the source code. The current release supports the metric calculation for C#-projects, but functionality supporting Visual Basic is on schedule.

The extension is dependent on the Microsoft “Roslyn” CTP (September 2012, v1.2), which needs to be downloaded and installed separately. Because I wasn´t sure, if I am allowed to distribute the Roslyn binaries, I decided to exclude them from the extension package and defined a dependency on the Roslyn Components instead. The Extension Manager will show the following dialog to you if the required package dependency is missing.

roslyn-alert

The download can be found at the Visual Studio Developer Center: http://bit.ly/YujBX8 or on NuGet: http://bit.ly/WheTeO. If the components will be removed after installing the extension, calculation of metric results isn´t possible and the following error message will be shown: “The calculation of metric results has failed. Couldn´t find the Roslyn CTP components.”

missing-roslyn

Currently no support of VS2012

Due to the fact that the current version of the Power Tool is not compatible with Visual Studio 2012, there won´t be an upgrade for the Code Metrics Viewer extension. There is a suggestion on Microsoft´s user voice portal to either open up the code metrics calculation interface or to provide a new version of the command line utility, that is not dependent on Visual Studio 2010. Using the following link you can vote for it: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3014740-please-update-visual-studio-metrics-power-tool-to

Update, 2013/01/7: I just used some time to play with the Roslyn CTP and created a tool that can calculate metrics from syntax trees and semantic models (in the strict sense a replacement for the Power Tool, that does not act on IL, but on source code). By now, I can calculate the same metric results provided by the Power Tool for C# projects and I also added some new metrics.

Update, 2013/01/14: I started to make the extension available to Visual Studio 2012; I just ported the existing code base and removed everything related to Microsoft´s power tool, that can´t be used anymore. The tool window gets a complete make-over supporting both the dark- and light theme. Maybe I have to replace functionality that is dependent on Windows Forms by using WPF, but I don´t know yet. The toolbar is now a native toolbar, that fits much better into the selected theme. As long as Roslyn isn´t ready-to-market, this extension will be a CTP as well, that requires an existing installation of the Roslyn components.

Update, 2013/01/16: A first look at the new UI…

dark-theme-ui

Update, 2013/01/25: I worked a lot on the user-interface… Instead of reusing the existing win-forms tree-listview implementation from the previous version, I decided to create a tree-listview using WPF. I am quite familiar with WPF, so I thought the hardest part of the entire project would be the implementation of the actual metric calculation functionality (which I have achieved within a couple of hours), but in the end, I used more time to style the WPF listview (thanks a lot to a Swedish friend of mine, who helped me to solve some very tricky issues and polish it). It was well worth investing the time because the new control allows scrolling horizontally, the scrollbars are themed automatically, the positioning of grid columns is now supported and I was able to remove some code that required P-Invoke (think this is a step in the right direction).

Update, 2013-01-27: I spiled Visual Studio´s glyph-service to show icons in the results view…

dark-theme-ui-2

Update, 2013-02-02: The extension is almost feature-complete; I am working on some details now. For instance, the new version of the tool doesn´t show a progress dialog anymore. Instead, it has a thin progress indicator that is embedded into the view (so it behaves the same way as any other tool windows in Visual Studio do).

dark-theme-ui-3

I reworked the trend icons (up- and down arrows) and used the colors of Visual Studio´s light theme so I can switch luminosity depending on the selected theme, to make them look good…

dark-theme-ui-4

dark-theme-ui-5

Calculated results can be kept for further analysis

In accordance with the test tools for Visual Studio Professional, the extension stores a compound report containing all calculated results of the solution in a folder named “MetricResults” below the solution directory. The output path can be changed in the “Reports” options page. The output path can either be a relative or an absolute path, but Visual Studio macros are not supported. The “Auto-Save”-feature is enabled by default. So, each time a report is calculated it will be stored in the configured output directory. The number of automatically saved reports can be limited, so the extension will only keep the latest results – the default value is 25. If you set the limit to zero, all reports will be kept; nothing will be deleted.

How to get it working?

Before you can use Code Metrics Viewer within Visual Studio 2010, you also need to download and install Code Metrics Power Tool 10.0. The Code Metrics Power Tool 10.0 is a console application which is available at Microsoft. The download can be found at http://bit.ly/lVH1Aa

The extension comes up with its own options page, where you can specify the installation path of the Code Metrics Power Tool. Please have a look at the Readme-file provided together with the Code Metrics Power Tool 10.0 to find out the installation folder (might be: <Program Files>\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop). The specified path shall not contain a filename (the extension will add the name of the executable). Consider that there is a difference in the <Program Files> path between 32- and 64-bit versions of Windows.

What is Code Metrics Viewer?

Well, Code Metrics Viewer is an extension for Visual Studio 2010 Professional, which integrates the Code Metrics Power Tool 10.0 into the development environment. I came up with this utility in March this year; since that the tool was downloaded 2.700+ times and I got a lot of positive feedback from developers. I was also very happy about the fact, that the tool was mentioned by an article in Microsoft´s Visual Studio Magazine: 17 free tools for Visual Studio. Actually, I am planning to publish a new release containing a bunch of new features at the end of this summer. By now, the description page of the tool at the Visual Studio Gallery is getting longer and longer, so it´s not very user-friendly anymore. To get rid of this problem, I will use this blog to bring all the information to you…

The Code Metrics Viewer is completely free; the download can be found here: http://bit.ly/iipJuw