Error MSB3491: 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\bilals\source\repos\DotNetCore.sonarqube\bin\targets\SonarQube.Integration.targets(301,5): error MSB3491: Cou
ld not write lines to file “C:\Users\bilals\source\repos\DotNetCore.sonarqube\conf\11\FilesToAnalyze.txt”. The process
cannot access the file ‘C:\Users\bilals\source\repos\DotNetCore.sonarqube\conf\11\FilesToAnalyze.txt’ because it is b
eing used by another process. [C:\Users\bilals\source\repos\DotNetCore\Elsy.Web\Elsy.Web.csproj]

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

Hey there.

What version of the SonarScanner for .NET are you using? Is there another analysis going on simultaneously on your machine?

We are analyzing .Net core project we have installed scanner globally by using dotnet tool install --global dotnet-sonarscanner command and version is 6.0.0 .
No we are analyzing only one project.

Thanks. v6.0 is relatively new, and I’d like to see if it could be the problem. Could you try an earlier version (like 5.15) and see if the issue persists?

I have downloaded 5.15 version and tried to analyze but still facing the same issue.

Hi Colin,

We have changed the version of Sonar Scanner to the 5.15 and terminated the .Net core processes. Which is starting when we are hitting the build command i.e. dotnet build application.sln.

Also, we have deleted the .sonarqube file from the application and re-run the build solution also tried to provide cpu usage as well.

Is there any concrete solution for this issue? Please let us know.


@Prasad_Gattewar @ramya.m Are you two working together, or are these two independent cases?

So far it’s one report of an issue we don’t understand yet, so I have no solution to propose right now.

ok, thanks for your support

Hi @Colin,

If this is a first for this issue, do you required any log file to understand it?

Please let me know, because it is blocker in SCA for us.


@Prasad_Gattewar Nobody answered my previous question :smiley:

I would suggest you start by figuring out what other process is holding onto this file when you get this error.

Yes, we are working together.