This project is read-only.

Proposal on code analysis improvement

May 26, 2013 at 1:34 PM
I love your extension pack. And i know that you are very experience at MSBUILD and microsoft products. I want to ask you opinion about Microsoft static Code Analysis improvement. It is connected with msbuild process so maybe it can be the part of your pack...

So the subject. As you know Static CA makes solution build mutch slower. In my case > 2x slower than without CA. We can disable it but that is bad decision to lose its power. So what can we do?

First lets see how CA works.

You build solution. At eatch project build after msbuild Compile target fxcopcmd.exe is called with paths to assemblies witch should be analyzed. fxcopcmd. generates CA xml log witch is used by VS (or maybe output stream). fxcopcmd.exe loads assemblies(fast) and analyzing its synchronously, so only one CPU is loaded and 3 (in my case) are doing nothing. Only after CA is finished the next project in project dependency chain is builded.

So the week place in CA were we can improve it - to force it work in paralel to use all CPUs.

I see such solution: To make fake fxcopcmd.exe(or better override code analysis target) that will take parameters from MSBUILD, remember its and instantly report to msbuild that all is ok and there were no error(through CA xml.log, or succeeded file, or maybe stream..). So MSBUILD will build the next project and at that time we will call real fxcopcmd.exe with saved parameters... if MSBUILD will call fxcopcmd.exe on next project - we will call one more time fxcopcmd.exe... so there will be few processes witch will load all CPU'S. After real fxcopcmd.exe will finished we can call our MSBUILD target witch will call only CA target from microsoft.common.targtets with out compiling and our fake fxcopcmd.exe will instantly repporting results(CA is finished at that time and we have log) to MSBUILD-VS.
That is my general vision.
What do you think? Will this speed up CA? Why Microsoft didn't make such staff and use only one CPU in CA?
Marked as answer by mikeFourie on 5/26/2014 at 5:19 AM
Jun 28, 2013 at 9:06 AM

Sorry for the slow response on this. I'm a bit low on time at the moment, but I'm thinking about what you have written and will try respond soon...