CSC error CS0006: Metadata file 'SonarAnalyzer.dll' could not be found
Asked Answered
B

2

5

I'm having random problems during my build process in TeamCity. I've got two configurations: First for Rebuild + Unit test. Second as artifact dependency, with SonarQube analyzer. When Teamcity is executing first configuration, I'm receiving random error messages every 5-10 builds:

CSC error CS0006: Metadata file 'E:\TeamCity\buildAgent2\temp\buildTmp\.sonarqube\resources\0\Google.Protobuf.dll' could not be found

CSC error CS0006: Metadata file 'E:\TeamCity\buildAgent2\temp\buildTmp\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll' could not be found

CSC error CS0006: Metadata file 'E:\TeamCity\buildAgent2\temp\buildTmp\.sonarqube\resources\0\SonarAnalyzer.dll' could not be found

Errors are totally random - when I run process one more time without any changes, error is gone. When I check buildTmp\.sonarqube directory, there is nothing there, no matter if build was successful or not.

I don't have any references in my project to those libraries and my Rebuild step has nothing to do with SonarQube. We are using SonarLint in VisualStudio 2017, but once again, we don't have any references to SonarQube in our *.csproj files.

Bursary answered 5/6, 2018 at 9:28 Comment(4)
Please check if all processes from previous scan are killed. I used to get this type of problem when previous scan was not successful and some processes (from previous scan) were still running. Every time you start a scan it creates temporary folder and copies the analyzer in that directory. For your case it seems that either that folder couldn't be created or some other process is still using that directory.Fourier
@Fourier Ok, but how can I achieve that? How can I make sure that all processes from previous build are killed?Bursary
Just make sure that previous scan was not terminated abnormally.Fourier
Some have suggested deleting the .sonarscanner folder, but that didn't work for me. Instead I had to use another build agent entirely by disabling the faulty build agent temporarilyOffering
S
13

I resolved this issue by deleting the entire .sonarqube folder.

Scalariform answered 6/7, 2020 at 10:19 Comment(3)
I emptied the .sonarqube folder in 2 places: Under my application project folder and under the %temp% folder. That worked for me.Cockle
This helped in a CI/CD pipelineLifelike
This worked for me: I removed .sonarqube folder in my user: C:\Users\MyUserName\.sonarqube and also remove C:\Users\MyUserName\AppData\Local\TempEstelaestele
C
0

deleting the entire .sonarqube folder also worked for me (using .Net Core 8, on MacOS with Rider)

Coco answered 12/9, 2024 at 10:10 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewExertion

© 2022 - 2025 — McMap. All rights reserved.