最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c - How to run Visual Studio's Code Analysis on the command line exactly like in the IDE? - Stack Overflow

programmeradmin6浏览0评论

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).

发布评论

评论列表(0)

  1. 暂无评论