How to force MSBuild to run Code Analysis without recompiling

后端 未结 3 1528
刺人心
刺人心 2021-02-05 12:44

By default, code analysis is only done for projects which are compiled. So when I run MSBuild from the command line, it runs code analysis only for the first time. On subsequent

相关标签:
3条回答
  • 2021-02-05 13:28

    It seems that

    1. del /s *.lastcodeanalysissucceeded
    2. msbuild DesktopBuild.proj /p:RunCodeAnalysis=true

    seems to work. The first step causes code analysis to "forget" about the previous runs and the second step forces it to run for every project, even if code analysis is not enabled in a project. If running this repeatedly, the already compiled projects won't be compiled again, only the code analysis is re-run.

    0 讨论(0)
  • 2021-02-05 13:28

    Simply set CodeAnalysisGenerateSuccessFile to false in the project file.

    <PropertyGroup>
      <RunCodeAnalysis>true</RunCodeAnalysis>
      <CodeAnalysisGenerateSuccessFile>false</CodeAnalysisGenerateSuccessFile>
    </PropertyGroup>
    
    0 讨论(0)
  • 2021-02-05 13:48

    I would try using FxCopCmd.exe, it can be usually found in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop. It's used by CodeAnalysis in Visual Studio, you should be able to use it with proper parameters.

    0 讨论(0)
提交回复
热议问题