As of today, in Visual Studio 2012 the Run Code Analysis command is not available for F# projects.
To enable Code Analysis in MSBuild, include the following elements in the project file:
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.fs</CodeAnalysisModuleSuppressionsFile> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>My.ruleset</CodeAnalysisRuleSet>
Unfortunately, even with the above elements, Code Analysis will not run for F# projects during the MSBuild process.
Edit the Microsoft.CodeAnalysis.Targets file which is located at:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\CodeAnalysis
or '$(Language)'=='F#' at the following locations:
<DefineConstants Condition="'$(Language)'=='C#' ">CODE_ANALYSIS;$(DefineConstants)</DefineConstants> <PropertyGroup Condition="'$(Language)'=='C#' or '$(Language)'=='VB'">
You may also download the modified Microsoft.CodeAnalysis.Targets file from here.