SonarQube says critical error: provide AssemblyVersion attribute for this assembly 36 times

I am using SonarQube for the first time, and as a result of scanning my project, 38 errors were detected. 36 - the same error:

Provide the AssemblyVersion attribute for this assembly.

SonarQube says that to fix this error I need to add

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

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

However, when I add it to a single file (with the correct name and version number), I get these errors in Visual Studio:

enter image description here

I read this questions and the answers to them and are more confused than before. I read this article on the “Right Way to Version Your Assemblies” and transferred my AssemblyInfo.cs projects to the linked VersionInfo.cs file, such as the proposed article.

At this moment I am at a loss, how to fix these 36 errors? What is the best practice for providing a version of Assembly?

0
source share
2 answers

I used DEPRECIATED sonar-scanner.bat to analyze my files.

I followed the instructions for setting up the SoanarQube scanner with MSBuild , as Amory Leve noted, and as soon as I built with MSBuild 15, AssemblyVersion errors disappeared from the analysis results.

+2
source

The rule checks assembly-level attributes that are already compiled, and you must follow the template with the associated AssemblyInfo.cs.

I think that you have encountered a problem with the release of reports on our side, we have an open ticket about this, and we are committed to providing a fix at the end of next week. If so, you should see much less reported errors with SonarLint for Visual Studio .

+1
source

Source: https://habr.com/ru/post/1271435/


All Articles