2

我按照 本教程创建了一个自定义 fxCop 规则并将它们集成到 Visual Studio 2010 中

除了 fxCop 规则仅在我对源代码进行任何更改(甚至只是添加一个空格)后的第一次构建时运行之外,一切似乎都运行良好。其他构建(无需对源代码进行任何更改)不会产生任何 FxCop 警告。

我猜它与这个事实有关,如果源文件时间戳与最后编译的程序集时间戳相同,c#MSbuild“Build”目标并没有真正重新编译

如何使 FxCop 代码分析运行每个构建?

4

1 回答 1

1

A couple of things come to mind:

  1. Because as you say, MSBuild may decide the build target is up to date, you could try running FxCop as a post-build step.
  2. Code Analysis creates a .CodeAnalysisLog.xml and .lastcodeanalysiscucceeded file fore each analysed file. Maybe deleting these files before building would also help.
于 2014-07-31T06:11:49.417 回答