Okay; let´s face it… calculating numbers is one thing. Getting a feeling for what the numbers are telling us is another one. The power tool calculates five metrics; the maintainability index, cyclomatic complexity, depth of inheritance, class coupling and lines of code. But what do the numbers really mean? Well, I would say there is no unique answer to that question. But there is a very good description about the interpretation of the results at Vitaly´s WebLog.
Monthly Archives: June 2011
How to get results for code behind XAML-files
In June, a user reported a problem where he does not see any results for code behind XAML files. I dove into the problem and figured out that code behind XAML files was handled by the power tool like generated code, which I had disabled by default using the /igc switch. The latest version of the tool allows to take control over the switch; if you want to calculate code metrics for generated code you have to make sure, that the /igc option is disabled.
Where can I find the Code Metrics Viewer in Visual Studio?
How can I calculate code metrics?
After a solution was loaded and successfully build, it can be analyzed by pressing the “Analyze Solution” button. The Code Metrics Viewer will utilize the power tool to create the code metric report for each assembly in the solution. Depending on the solution size, this can take a while… The results will be shown in the grid.
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 it´s own options page, where you can specifiy 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 enviroment. 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, the tool was refered by Visual Studio Magazine to be one of the 17 best free tools for Visual Studio. Actually, I am planning to publish a new release containing a bunch of new features in 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 completly free; the download can be found here: http://bit.ly/iipJuw



