gpt4 book ai didi

c# - 仅在构建服务器上出现代码分析错误

转载 作者:行者123 更新时间:2023-11-30 22:13:24 25 4
gpt4 key购买 nike

我试图弄清楚为什么代码分析会在我们的构建服务器上运行并检测错误,但在本地构建时我没有看到相同的错误。这是一个失败的代码示例(因为我们的 STBi 首字母缩略词):

string message = string.Format(CultureInfo.CurrentCulture,
"Unit STBi [{0}] blah... ",
unitStbiParameter.Stbi);

在我们的 TFS 构建服务器上构建失败并出现如下错误:

CA2204 : Microsoft.Naming : Correct the spelling of the unrecognized token 'STBi' in the literal '"Unit STBi ["'.

问题是我不知道为什么在笔记本电脑上构建解决方案时没有看到这些 CA 错误。这是在项目的属性中:

enter image description here

构建定义是这样的:

enter image description here

为什么构建机器上的构建会显示错误,而不是我的笔记本电脑?这几乎就像构建服务器正在使用不同的 CA 规则集。这可能吗?

旁注:我尝试将 STBi 添加到 CustomDictionary.xml(如下),但仍然无济于事。但这是一个单独的问题。

<!-- This is here because it's a workaround for a bug: http://connect.microsoft.com/VisualStudio/feedback/details/521030/ -->
<DiscreteExceptions>
<Term>STBi</Term>
</DiscreteExceptions>

最佳答案

您可能需要在项目中指定 CodeAnalysisCulture MSBuild 属性(有关示例,请参见 http://blogs.msdn.com/b/codeanalysis/archive/2007/08/12/new-for-visual-studio-2008-spelling-rules.aspx)。如果没有此设置,拼写规则将使用运行分析的帐户的 Windows UI 文化信息,这可能与您的帐户和构建帐户不同。

关于c# - 仅在构建服务器上出现代码分析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19182944/

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