Great extension, thanks! Exactly what I was looking for plus loads more. It installed straight from the Visual Studio Gallery and worked as soon as I set the path to the Tools 10.0 (as explained in your instructions). Those who have had problems with this probably didn't bother to read the instructions for their VCR either!
I particularly like the save as Excel feature that allows one to do some more analysis.
I found this tool to be very useful giving a clear view of the results by DLL and allowing you to drill into the data (or search with the filter option) to find problem classes or methods; altogether easier to use than the command line tool.
Code Metrics could not be located in the following path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop I tried placing quotes around the path, but this caused "Analyse" to crash Visual Studio. I am running VS 2010 SP1 (with Visual Assist X) on Win7.
Please make sure that you´ve installed the Code Metrics Power Tool 10 (as described). Please refer to the project blog, to get further information... I would be glad, if you could think about your rating again (ask yourself if it´s fair).
The extension should detect the correct path automatically if you press the locate button; presupposed you installed the tool correctly. If not please have a look at: http://codemetricsviewer.wordpress.com/2011/06/26/how-to-get-it-working/
Thank you so much! I had just been using what was included on VS2010 (right click project "Calculate code metrics") and it wasn't working all the time (got error "Could not resolve member reference" and it's a huge team solution so changing references and things is not easy). I installed this Viewer, and everything seems to work great!
I've got a short amount of time to examine code developed by an outsource company and this gives me terrific high-level information about the project. The viewer allows you to drill into the details also. It has made me a lot more productive and the information with some explanation can be shared with less technical people, which is also a huge plus.
The "Goto Next" button is great, but it would be even better if we could make it look at only Classes OR Methods, not both at the same time. For example, I wanted to look for Methods that were over 20 lines long, but it kept jumping to almost every class in the solution...
I have multiple projects which this tool is working great, but I have one that is a VSShell project, and it just fails to run. I haven't found a log or anything, but I suspect it's failing because one of the shell dll's is auto-generated in C++. If there's a way for me to turn on logging I can provide the results.
The tool does not have a logging mechanism. The extension runs the power tool for each project in the solution; if an error occurs it will be shown in the grid (btw, the extension is for managed code only, so C++ projects don´t work). If want to share detailed information regards your problem you can drop me a line via email...
I am having MS VS 2010 Prof and had installed Tool from this location http://www.microsoft.com/en-us/download/details.aspx?id=9422 and thereafter installed viewer from http://visualstudiogallery.msdn.microsoft.com/9f35524b-a784-4dbc-bd7b-6babd7a5a3b3/view/Discussions/0.
Have set Code Mteric Power Tool Path to C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop
and Do not generate code metrics for generated code (/igc) is unchecked.
Still when I click on Analyze Solution on the Code Metric Viewer, nothing happens. I tried it with a simple C++ program, my solution had just two CPP and a header file. I am not getting any error, but nothing is showing up on the metric window. I wanted to use this viewer to find LOC for various solutions. Somehow it is not working and even after going through your blog, I am unable to make out what is amiss. Any thoughts? Thanks..
I've just installed your tool in my VS2012 system, thanks for all of your work. At the moment, however,I can't seem to get it to work.
I have a solution with a Winforms main EXE A, and two class library DLLs B and C (plus a DLL with unit tests). A depends on B and C; B depends on C; C has no dependencies. When I click Analyze Solution, I get CA0055 and CA0052 for C (which prevents A and B from being loaded, but the root cause is failure to load C). CA0055 says, Could not load file : C:\Windows\Systems32\C.dll, which is clearly the wrong path. My question is, why's it looking in C:\Windows\Systems32?
The behavior is the same using Debug and Release configurations. I am targeting the x64 platform. I read your advice concerning these errors when using custom configurations, opened the C.csproj file, which shows an OutputPath of bin\x64\Debug for the Debug config, and bin\x64\Release for the Release config. I have confirmed this is where the results of new builds get placed, and that new assemblies do get generated when I ask for a build.
If I use Calculate Code Metrics, all the assemblies are found and analyzed.
Thanks again for your work,
You´ve installed it into VS 2012, really? That´s weird, because this extension targets VS 2010. The Power Tool 10.0 is not compatible to VS 2012 or above (of course I know there is a new version of the tool supporting VS 2012, but it´s not supported by my extension yet). You can send me a private message, if you like... and we can dig into the problem together.
I'm sorry, I mis-spoke/typed: it's installed in VS2010, not VS2012. (So much for providing an accurate description of the problem.) But I think the erst of the details I provided are accurate.
I would be grateful for any digging you could help me do. I will send a private email to the googlemail contact for you that accompanied your "How to get rid of the errors CA0055 and CA0052" article; is that the correct email address?
HHi. I started today using the power tool but have a problem: my assemblies references other assemblies that are stored in multiple folders. As far as I have seen it's only possible to specify one directory to search for dependencies.... It's possible to specify multiple folders? How can I solve this problem?
No, this is not possible. But you can run the power tool directly. You can use an XSLT transformation to convert the XML report to CSV format. This example might give you an idea: http://bit.ly/16rL0Nw
Yes; I had the plan to provide the extension for VS2012 as well. The problem is, that the current version of the Power Tool is not compatible to VS2012; that´s the reason why I did not provide a new extension.
Due to the fact, that the code metrics feature is now integrated even into the Professional edition, I guess that Microsoft won´t ship a new commandline utility (consider it was not intended to be used within the IDE, but in a build process).
Of course, I have some ideas for workarounds, just as ideas of how to create a replacement, but this might cost to much time...
I've got a solution with a single executable and the rest are dll libraries that get loaded dynamically. The code metrics are "calculated" for each file right until near the end when it says "No process is associated with this object" and goes no further.
Can anyone shed any light?
I´ve never experienced this behavior during development or in a testing environment. The extension utilizes the Metrics.exe application (the Code Metrics Power Tool) by creating a process and waiting for the exit. The wait-for-exit operation might fail, if the process could not be created. Maybe you´re using an anti-virus or anti-spyware software that denies the process creation... just an idea.
I see the same issue when trying to Analyze my solution.
My solution has 10 assemblies, and the analysis seems to go through 3 of them. I can see that Metrics.exe does start, but seems to die prematurely. I've tried 'unloading' projects to see whether I can get further, but I still get the same error message.
By default, the Tools>Options>Code Metrics>Reports>Output path setting is "MetricResults". Should this be changed to something else? Also clicking on the ellipsis doesn't seem to allow me to browse. I'm just wondering whether the problem is because the /out param is invalid.
Hello, I have download the tool and placed it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop. Why I always get the error massage "metrics.exe is not recognized as an internal or extrnal command, operable program or batch file" ? What have I done wrong?
except of that, the tool inside visual studio is work fine.
someone can please help?