gpt4 book ai didi

c# - Visual Studio 2013 中的 FxCop 和代码分析

转载 作者:太空狗 更新时间:2023-10-29 20:23:38 25 4
gpt4 key购买 nike

我想在我的项目中进行代码分析,我正在使用 Visual Studio 2013。我可以看到一个 Analyze 选项卡,这将有助于进行代码分析。所以我的问题在下面

  • 我应该安装 FxCop 还是继续使用 Visual Studio 的内置代码分析?
  • 除了从 Visual Studio 进行代码分析外,FxCop 是否提供任何其他优势?

刚刚在这里找到一个帖子,但我不确定是否使用 Fxcop?

http://michaelsync.net/2014/07/19/status-of-fxcop-code-analysis

最佳答案

(免责声明:我在 Microsoft 的 Visual Studio 工作,但不在 C# 或 CIL/FxCop 团队,而且我不了解他们的工作)

我的理解是,Visual Studio 2013 中的代码分析引擎(在“分析”菜单下)与 FxCop 中使用的引擎基本相同,只是内置于 Visual Studio 和 MSBuild(这使得构建分析更易于自动化)。 VS2013 使用旧的“手写” native C# 和 VB.NET 编译器。

Visual Studio 2015(“VS 14”)使用新的“Roslyn”编译器集,其分析引擎有所不同。您链接到的博客文章清楚地表明了这一点:

we’re proving out our new Roslyn-based diagnostics by reimplementing the high-value, low-false-positive FxCop rules using Roslyn. We haven’t yet decided when to pull the switch and officially swap out the IL-based FxCop rules for rules built on Roslyn, but the new live analysis engine will be built into the C#/VB compilers in VS “14”

...据此,据说 VS2015 包括旧的 FxCop 规则以及基于 Roslyn 的新规则,但不太可靠的基于 FxCop CIL 的规则已被 Roslyn 规则取代。

关于c# - Visual Studio 2013 中的 FxCop 和代码分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31801845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com