SonarQube 说严重错误:为此程序集提供 'AssemblyVersion' 属性 36 次

SonarQube says critical bug : provide an 'AssemblyVersion' attribute for this assembly 36 times

我是第一次使用 SonarQube,对我的项目进行扫描后发现了 38 个错误。 36 个是相同的错误:

Provide an 'AssemblyVersion' attribute for this assembly.

SonarQube 说要解决这个错误我需要添加

[assembly: AssemblyTitle("MyAssembly")]
[assembly: AssemblyVersionAttribute("1.2.125.0")]

在 36 个文件中的每个文件中的命名空间之前...

然而,当我将它添加到一个文件(具有正确的标题和版本号)时,我在 Visual Studio 中得到这些错误:

我读了这个 questions and its answers 并且比以前更困惑了。 我阅读了 this article 关于 "The right way to version your assemblies" 的内容,并将我的项目 AssemblyInfo.cs 移动到链接的 VersionInfo.cs 文件中,就像文章中建议的那样。

此时我手足无措,我该如何修复这36个错误?提供汇编版本的最佳实践是什么?

该规则正在检查已编译的程序集级属性,您应该能够遵循带有链接 AssemblyInfo.cs 的模式。

我认为您遇到了我们这边的问题报告错误,我们有 an open ticket about it and we are aiming at providing a fix at the end of the next week. If that's the case, you should be seeing much less reported errors with SonarLint for Visual Studio

我正在使用 DEPRECIATED sonar-scanner.bat 来分析我的文件。

我按照 Amaury Leve 指出的指示设置 SoanarQube scanner with MSBuild,一旦我使用 MSBuild 15 进行构建,AssemblyVersion 错误全部从分析结果中消失。