SonarQube Error :Could not write lines to file

  1. which versions are you using (SonarQube, Plugin ): sonarqube 9.9,Branch plugin :1.14.0
  2. what are you trying to achieve:Analyzing .net core project and getting error while build command as mentioned below:

C:\Users\asawariku\source\repos\DotNetCore.sonarqube\bin\targets\SonarQube.Integration.targets(301,5): error MSB3491: Cou
ld not write lines to file “C:\Users\asawariku\source\repos\DotNetCore.sonarqube\conf\11\FilesToAnalyze.txt”. The process
cannot access the file ‘C:\Users\asawariku\source\repos\DotNetCore.sonarqube\conf\11\FilesToAnalyze.txt’ because it is b
eing used by another process. [C:\Users\asawariku\source\repos\DotNetCore\WebApplication.csproj]

I am trying to get .net core analysis on sonarqube 9.9

I am trying to analyze dotnet framework project using CMD. And i am getting the below error:
Could not write lines to …/FileToAnalyze.txt.

(I am using SonarQube community version 9.9 with latest sonar scanner.)
Could you please help me resolving this issue?

I am stuck in this issue since a week and it is high priority task to complete build asap.
please help me with the concrete solution.
We are facing same issue for .Net core project as well.

Hi,

These two topics have been combined because even if they don’t belong to the same person using multiple accounts, they’re basically the same problem.

The error message is pretty clear:

At a guess, you have something “helpful” like “Microsoft Defender” or some other antivirus on your system interfering with analysis. You should either remove this from your build agents or except the workspace directory.

 
HTH,
Ann

Hi @ganncamp ,

I was also facing the same issue and as per your suggestion I have checked all the build agent folders, also checked all the processes and services by using process explorer but we didn’t find any file running related to that.

In my case neither Microsoft defender nor antivirus interfering in my analysis.
Work around’s I have tried like:
Completely uninstalled Sonar Scanner from machine and after that i have rebuild my application using command (dotnet build solution.sln). And Using this, my application was building successfully.
As soon as I install sonar scanner again it gives me same error as mentioned in above chats.

Can you suggest more on this?

Hi,

Sorry, I don’t have any other wisdom for you.

The scanner isn’t able to access the files because they’re locked by another process. You’re going to have to track that down.

 
Ann