问题标签 [fxcopcmd]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
428 浏览

sonarqube - 如何从 FxCopCmd 中删除 /aspnet 参数(错误 CA0001)

我正在尝试在 SonarQube 4.5.1 上使用 FxCop,但 FxCopCmd 失败了。

问题是,当 SonarQube 创建 FxCopCmd 调用时,他添加了参数 /aspnet。由于我的程序是 Web 项目而不是网站,因此此参数导致 4 个分析引擎异常:

C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace \Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /强制输出 /searchgac /aspnet

如果我在没有 /aspnet 参数的情况下执行相同的调用,FxCopCmd 运行良好:

C:\Program Files\Microsoft Fxcop 10.0>FxCopCmd.exe /file:G:\sbs1\workspace\Projeto2\DCX.ITLC.Web\bin\DCX.ITLC.Web.dll /ruleset:=G:\sbs1\workspace \Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-sonarqube.ruleset /out:G:\sbs1\workspace\Projeto2\target\sonar\projeto2_projeto2_DCX.ITLC.Web\fxcop-report.xml /outxsl:none /强制输出/searchgac

我正在使用的组件是: - SonarQube 4.5.1 - Visual Studio Projects 1.2 的分析引导程序 - C# 3.3

我很想找到一种方法来禁用 SonarQube 上 /aspnet 参数的使用。任何帮助将不胜感激。

0 投票
1 回答
710 浏览

c# - 声纳 fxcop 结果未显示

我正在尝试在一些 ASP.Net 应用程序上使用声纳。我已经安装了声纳并配置了 C# 环境,并且我得到了这个工作......除了 FXcop(代码分析)。

我遵循了官方文档

  • sonar-runner.bat 没问题
  • FXCop 路径配置良好
  • Sonnar-runner 正确启动 FXcop (12.0)
  • FXCop 在项目的.sonar 目录下构建“fxcop-report.xml”
  • 该文件包含一些我应该在 Sonarqube 中看到的“问题”
  • FXCop 退出 1024 代码,这对于声纳运行器来说似乎没问题
  • sonar-runner 执行似乎一直都很好:“ANALYSIS SUCCESSFUL”......然后“EXECUTION SUCCESS”

我的默认质量规则“仅”是 FXCop 规则。

但是当我连接到 sonarqube 时,我的项目默认设置为“0”。我的意思是,我真的希望有 0 个默认值,但这不是现实。

我一直在搜索,我在官方论坛上看到说报告中的问题元素应该具有“路径”和“文件”属性才能使其正常工作,我就是这种情况:

希望有人注意到我想念的东西!!!谢谢。

0 投票
0 回答
617 浏览

powershell - CodeAnalysis using msbuild does not fail on warning/error

I started down this path of wanting to do code analysis on my solution using msbuild. I was looking at FxCop but it appears to now be part of Visual Studio and from my understanding you need Visual Studio installed on your build agents.

I am calling msbuild from a powershell using the following command;

It appears to run the code analysis and output warnings but never fails the build, even after I added <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> to my .csproj file.

All I want is to run code analysis from msbuild command line and have it fail the build if any warning is found. I understand it can be done in Visual Studio but I need to be able to run this from the command line (with/without VS2013)

Am I missing something? Shouldn't /p:RunCodeAnalysis=Always and setting the CodeAnalysisTreatWarningsAsErrors to true be all that is needed?

0 投票
3 回答
542 浏览

visual-studio - Visual Studio 代码分析死锁

从 VS2013 运行代码分析时出现死锁错误。我很确定我需要做的就是增加或禁用死锁超时,因为我可以使用独立的 FX Cop 10 运行代码分析。我可以对 csproj 文件做些什么来禁用死锁保护吗?

0 投票
0 回答
334 浏览

fxcop - FXCop 组件加载失败

命令行:

报告中的错误:

有人有什么想法吗?

0 投票
2 回答
482 浏览

c# - 无法在 SonarQube 中找到并安装 Analysis Bootstrapper 插件

我正在尝试在声纳中启用 FXcop 规则并分析代码。但我收到以下错误

错误:原因:必须设置属性“sonar.cs.fxcop.assembly”,并且必须已构建项目以执行 FxCop 规则。此属性可以由 Visual Studio Projects 插件的 Analysis Bootstrapper 自动设置,请参阅:http ://docs.codehaus.org/x/TAA1Dg 。如果您希望跳过未构建项目的分析,请设置属性“sonar.visualstudio.skipIfNotBuilt”。

控制台日志指出该属性将由Analysis Bootstrapper for Visual Studio plugin自动设置。但我无法在声纳中找到并安装这个插件。

我还尝试在 sonar 中设置以下属性。但仍然得到同样的错误

为什么 Analysis Bootstrapper 插件没有出现在声纳插件区域?

0 投票
0 回答
264 浏览

jenkins - 使用 jenkins 管道作为代码显示 fxcop 结果

我在构建 .net 解决方案项目的詹金斯有管道工作。运行 MS 测试并使用命令行(批处理)使用 FxCopCmd 进行静态代码分析。我想在 jenkins 中展示 fxcop 结果。我知道已经有一个 Violation 插件可用,但它有助于 FreeStyle 工作。我们如何使用 Pipeline Job 显示结果?

0 投票
0 回答
211 浏览

c# - 我们能否使用 FxCopCmd 对目录(.exe 和 .dll 的集合)而不是特定文件(.exe 或 .dll)执行代码分析

我在使用 FxCopCmd 分析代码时遇到问题。当我检查一个 sing 文件时它工作得很好,但是当我用目录替换它时它不起作用。可能是我没有使用正确的命令。

上述命令完美运行。但我提到的不是文件,而是一个目录

现在它给出了一条错误消息“未执行分析”。如果有任何机构可以在这个问题上帮助我,将非常感激。

0 投票
1 回答
527 浏览

c# - FxCop: Suppression message for async method

I am using FxCopCmd tool for static code analysis. Since we already had a huge codebase, we baselined existing issues using baseline.exe tool that comes with FxCop.

I am observing that if I add a new method to my C# class, then some of the suppression messages in GlobalSuppression.cs file stop working and I get issues for the code I haven't touched.

Example:

This throws following error:

CA1031 : Microsoft.Design : Modify 'Program.d__0.MoveNext()' to catch a more specific exception than 'Exception' or rethrow the exception

To suppress the 'CA1309 UseOrdinalStringComparison' issue, I added following suppression message in GlobalSuppression.cs file

[module: SuppressMessage("Microsoft.Globalization", "CA1309:UseOrdinalStringComparison", Scope="member", Target="ConsoleApplication1.Program.d__0.MoveNext()", MessageId="System.String.Equals(System.String,System.StringComparison)", Justification="")]

But if I add one more method in the class, then this suppression message stops working. This is because method1 is async and so a new class is created (refer this) in compiled code (which was <method1>d__0 in the first case). But when I add another method before method1, then the new class created in compiled code is named <method1>d__1. Consequently, the suppression message is not applied and FxCop again starts showing errors in the code.

Is there any way to suppress FxCop errors for async methods permanently?

0 投票
0 回答
92 浏览

c# - FxCop 不理解空条件运算符

考虑这段代码:

FxCop 将其标识为“CA2213:DisposableFieldsShouldBeDisposed”(用于 activeFile),因为它似乎不理解?.操作员。

是否有一个已知的最低版本的 FxCop 可以接受这个?

谢谢!