I have a VS solution with multiple projects. The code is written in C. I am using Visual Studio 17.12.4 Enterprise. When I run the Code Analysis within VS, the analysis is successful on all projects. Note, I am running the clang tidy and Microsoft code analysis.
I try to repeat this process on the command line with the following:
msbuild mySolution.sln /t:Rebuild/p:Configuration=Debug /p:Platform=x86 /p:RunCodeAnalysis=true /p:CodeAnalysisRuleSet="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset" /flp:logfile=%FILELOG%
The analysis works on most of my projects, but it fails on a couple. The reason for failure appears to be due to missing prebuild steps in those project files. However, if I set RunCodeAnalysis=false, then those prebuild steps are successful. The prebuild steps are also successful when running code analysis on Visual Studio.
So what am I missing? Is the Visual Studio Code Analysis doing something different?
I have tried multiple combinations of Target (ClangTidy, Build, Rebuild, Rebuild;ClangTidy, etc).