由于代码分析设置,TFS 构建失败

发布于 2024-12-13 10:26:19 字数 1288 浏览 0 评论 0原文

我已经为所有项目打开了代码分析,并验证了每个配置(调试、发布、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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倥絔 2024-12-20 10:26:19

由于某种原因,即使在失败项目的“属性”中打开了代码分析,更改也没有反映在 .csproj 文件中。手动编辑 .csproj 文件以包含最小规则集后,一切正常:

<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>

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:

<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
旧人 2024-12-20 10:26:19

构建服务器上的 Visual Studio 版本应该支持代码分析并且有一些 已知问题:

不幸的是,由于在发布周期的后期发现了一个错误
代码分析的安装不会在 x64 构建服务器上执行。
这意味着尽管代码分析正确,但您不会看到代码分析正在运行
配置。目前的解决办法是安装 Visual Studio
SKU 包括构建机器上的代码分析以获取 FxCop
安装。

Visual Studio edition on build server should support for code analysis And there are some known issues:

Unfortunately due to a bug discovered very late in the release cycle
the install for Code Analysis does not execute on x64 build servers.
This means you won’t see code analysis running despite correct
configuration. The work around for now is to install a Visual Studio
SKU that includes Code Analysis on the build machine to get the FxCop
installation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文