SonarQube说出严重错误:为此程序集提供"AssemblyVersion"属性36次 [英] SonarQube says critical bug : provide an 'AssemblyVersion' attribute for this assembly 36 times

查看:226
本文介绍了SonarQube说出严重错误:为此程序集提供"AssemblyVersion"属性36次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using SonarQube for the first time and a scan of my project revealed 38 bugs. 36 are the same bug:

为此程序集提供"AssemblyVersion"属性.

Provide an 'AssemblyVersion' attribute for this assembly.

SonarQube说要解决此错误,我需要添加

SonarQube says to resolve this bug I need to add

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

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

before the namespace in each of the 36 files...

但是,当我将它添加到一个文件(具有正确的标题和版本号)时,在Visual Studio中会出现以下错误:

However, when I add it to even one file (With the correct title and version number) I get these errors in Visual Studio:

我阅读了问题及其答案,并且比以前更加困惑. 我阅读了这篇文章关于正确的方式来对程序集进行版本控制",并将项目的AssemblyInfo.cs移至链接的VersionInfo.cs文件中,如本文所建议.

I read this questions and its answers and am more confused than before. I read this article about "The right way to version your assemblies" and moved my projects' AssemblyInfo.cs into a linked VersionInfo.cs file like the article suggested.

这时我很茫然,如何解决这36个bug?提供程序集版本的最佳实践是什么?

At this point I am at a loss, how do I fix these 36 bugs? What is the best practice for providing Assembly Version?

推荐答案

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

I was using the DEPRECIATED sonar-scanner.bat to analyze my files.

我按照说明设置了 SoanarQube扫描仪正如Amaury Leve所指出的那样,使用MSBuild 就可以了.一旦我用MSBuild 15构建,所有AssemblyVersion错误都从分析结果中消失了.

I followed the directions to set up SoanarQube scanner with MSBuild as Amaury Leve pointed out and once I was building with MSBuild 15 the AssemblyVersion bugs all disappeared from the analysis results.

这篇关于SonarQube说出严重错误:为此程序集提供"AssemblyVersion"属性36次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆