Code Analysis failing with ‘Invalid settings passed to CodeAnalysis task’
I’ve seen recent reports of Visual Studio Code Analysis failing (such as this one) with the following error:
Invalid settings passed to CodeAnalysis task. See output window for details.
Looking in the output window will show something similar to:
Switch '/targetframeworkversion' is an unknown switch.
As I’ve mentioned earlier, the /targetframeworkversion switch was added in Visual Studio 2008 SP1 to support the new multi-targeting rule. The fact that the FxCop does not understand the switch, is a big indicator that something went astray with the installation of the service pack.
Luckily the fix is rather easy, simple re-install it.