使用 TFS 2008 启用代码分析,影响最小
我们在 TFS 2008 上有一个 .NET Web 应用程序,其中包含 172 个项目,涵盖应用程序的所有 3 层,并使用 Team Build for CI。我们使用VS2010进行开发。
我们希望使用最低推荐规则集激活所有项目的代码分析,并在 TFS 中强制执行签入策略,即代码分析应在签入之前运行一次。但我们希望对开发人员的影响降到最低他们的定期开发检查过程。每次我们在项目属性中启用代码分析时,该项目的正常构建时间都会增加 100%。 我们对代码分析问题进行了分析,尽管对于这个规则集也有很多问题,但它可以分发给所有可以在进行现有增强的同时修复这些问题的开发人员。
所以基本上我们有两种类型的构建:
- 正常构建用于检查代码的适当性,在签入代码之前会发生几次。
- 在签入之前的最终构建,我们还想检查代码分析。
因此,我们创建了另一个名为“DebugWithCA”的解决方案配置,其项目启用了代码分析,以便开发人员在签入代码之前,将配置从 Debug 切换到 DebugWithCA,构建并修复代码分析问题,然后签入。这样,对于正常构建,开发人员停留在调试解决方案配置中,而不必承担代码分析带来的额外构建时间。
但这似乎也是一种开销,因为我们白天有很多签入(许多开发人员),并且每次签入和切换回来时切换解决方案配置都会变得很痛苦。
有没有更简单的方法来完成我们的要求? 在进行构建时,我们是否可以指定一个快捷键,以便使用代码分析进行构建或使用 VS2010 中的特定解决方案配置进行构建?
We have a .NET web application with 172 projects on TFS 2008 that encompass all 3 tiers of the app and use Team Build for CI. We use VS2010 for development.
We would like to activate code analysis for all projects with Minimum Recommended Rule Set and enforce the check-in policy in TFS that code analysis should be run once before you check in. But we would like to have minimal impact to our developers in regard to their regular development check in process. Every time we enable code analysis in a project's properties, a normal build time for that project shoots up by 100%.
We did an analysis of the code analysis issues and though there a lot of them even for this ruleset, it can be distributed among all developers who can fix them while doing their existing enhancements.
So basically we have two types of builds that we do:
- Normal builds to check the propriety of the code which happens several times before we check-in the code.
- Final build just before the check-in where we would also like to check for code analysis.
Hence we created another solution configuration called "DebugWithCA" which had its projects enabled for code analysis so that before the developer checks-in the code, he switches the configuration from Debug to DebugWithCA, builds and fixes the code analysis issues and then checks in. So that for normal builds, the developer stays in Debug solution configuration and does not have to bear the additional build time caused by Code Analysis.
But this too seems like an overhead as we have a lot of check-ins during the day (many developers) and switching solution configuration every time you check-in and switching it back becomes a pain.
Is there an easier way to accomplish our requirement?
While doing a build, is there a shortcut key that we can assign so that it builds with Code Analysis or builds with a specific solution configuration in VS2010?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以想到两种实用的方法来解决你的问题。这两个建议都使代码分析脱离了开发人员的关键开发路径/时间。
I can think of two pragmatical approaches to circumvent your problem. Both suggestions take the code analysis out of the critical development path / time of the developer.