Visual Studio 2010 Code Analysis - Run on Solution

后端 未结 2 677
抹茶落季
抹茶落季 2021-02-19 01:02

I would like to manually run code analysis for an entire solution, not on building the project, and not using FXCop, if possible. I did enable CA on build but it really, really

相关标签:
2条回答
  • 2021-02-19 01:26

    I also don't know of a menu/command that can be used to run CA for all projects, but you can create a new solution configuration (e.g. CodeAnalysis based on Debug) and set up CA for each project to run for that Configuration, letting you run CA for all projects without slowing down your regular Debug build.

    1. Create the new configuration called "Code Analysis" (Build -> Configuration Manager, then <New...> under Active solution configuration).

    2. In the CA properties tab for each project, set CA to run for the "Code Analysis" configuration, and not to run for the Debug configuration (and any other Configurations you don't want CA to run on).

    3. You can do the same on the Code Contracts tab if you normally don't want contract checking on your regular build configurations.

    Now when you set your solution configuration to Debug and build, you should not have CA and CC being performed. When you do want the CA and CC checks done, change the configuration to 'Code Analysis' and build.

    It's not as convenient as a menu or toolbar option, but it might be an alternative that works for you.

    Hope this helps.

    0 讨论(0)
  • 2021-02-19 01:38

    No, I don't think you're missing anything. The CA from VS2010 can only be run manually per project. This can indeed become very cumbersome for large solutions if you don't want the CA on build. You could try to disable some rulesets to decrease the slowdown though.

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