Simply put, Visual Studio is not able to run its code analysis tool in a subset of the projects in the solution.
However, there are several possible workarounds that you might consider.
Extract active projects into a separate solution:
Create a new blank solution, add all existing active projects to it, and run code analysis for a smaller solution. Solutions will be synchronized because the project files are the same. You can give false reports if these projects depend on inactive projects.
Use an empty rule set for inactive projects:
Add a new file of the “Code Rule Set” type, edit it, change its name to “No rules” in its “Properties” window and clear all the rules (if checked).
Then go to the properties of your solution, select "General Properties → Code Analysis Settings" and change all the rules for inactive projects to "No Rules". You can do it in 306 clicks.
This will give better execution time for code analysis, but it will also flood the result window with CA0064: the analysis was not performed because the specified rule set did not contain any FxCop rules.
Use the trivial rule set for inactive projects:
As above, but then add any one rule to "No Rules" that you do not expect to see at all. This will make code analysis slower (but still much faster than using the actual rule set) and you will no longer receive warning CA0064.
To be completely honest, Visual Studio's built-in code analysis has some fundamental flaws, and I would recommend using a professional external tool like ReSharper, or the tools suggested in other comments. Using an empty / trivial set of rules must necessarily provide the desired result, but this is more a workaround than an actual solution.
Alex walker
source share