由于代码分析设置,TFS 构建失败
我已经为所有项目打开了代码分析,并验证了每个配置(调试、发布、QA 等)的代码分析都已打开。我的本地构建当然没问题,但我的 TFS 构建仍然失败。
以下是我的构建的放置位置中失败的输出 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<Tests xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BuildConfigurationSettings name="Debug" ProjectName="MyProject" Platform="AnyCPU">
<Test>
<MSBuildSchemaName>CodeAnalysisRuleSet</MSBuildSchemaName>
<ExpectedValue>MinimumRecommendedRules.ruleset</ExpectedValue>
<ActualValue />
<Verify>true</Verify>
<TestExecuted>true</TestExecuted>
<IsEqual>false</IsEqual>
</Test>
</BuildConfigurationSettings>
<BuildConfigurationSettings name="Release" ProjectName="MyProject" Platform="AnyCPU">
<Test>
<MSBuildSchemaName>CodeAnalysisRuleSet</MSBuildSchemaName>
<ExpectedValue>MinimumRecommendedRules.ruleset</ExpectedValue>
<ActualValue />
<Verify>true</Verify>
<TestExecuted>true</TestExecuted>
<IsEqual>false</IsEqual>
</Test>
</BuildConfigurationSettings>
</Tests>
I've turned on Code Analysis for all of my projects, and have verified code analysis is on for each configuration (Debug, Release, QA, etc). My local builds are of course fine, my TFS builds are failing still.
Here is the failed output XML file in the drop location for my builds:
<?xml version="1.0" encoding="utf-8"?>
<Tests xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BuildConfigurationSettings name="Debug" ProjectName="MyProject" Platform="AnyCPU">
<Test>
<MSBuildSchemaName>CodeAnalysisRuleSet</MSBuildSchemaName>
<ExpectedValue>MinimumRecommendedRules.ruleset</ExpectedValue>
<ActualValue />
<Verify>true</Verify>
<TestExecuted>true</TestExecuted>
<IsEqual>false</IsEqual>
</Test>
</BuildConfigurationSettings>
<BuildConfigurationSettings name="Release" ProjectName="MyProject" Platform="AnyCPU">
<Test>
<MSBuildSchemaName>CodeAnalysisRuleSet</MSBuildSchemaName>
<ExpectedValue>MinimumRecommendedRules.ruleset</ExpectedValue>
<ActualValue />
<Verify>true</Verify>
<TestExecuted>true</TestExecuted>
<IsEqual>false</IsEqual>
</Test>
</BuildConfigurationSettings>
</Tests>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于某种原因,即使在失败项目的“属性”中打开了代码分析,更改也没有反映在 .csproj 文件中。手动编辑 .csproj 文件以包含最小规则集后,一切正常:
For some reason, even though Code Analysis was turned on in the 'Properties' for the failing projects, the changes were not being reflected in the .csproj file. After hand-editing the .csproj file to include the minimum ruleset, everything was working fine:
构建服务器上的 Visual Studio 版本应该支持代码分析并且有一些 已知问题:
Visual Studio edition on build server should support for code analysis And there are some known issues: