Dotnet command fails when set to run before SonarQube Analysis and Publish task

I have an Azure DevOps build pipeline which fails to run a dotnet build task when the SonarQube analysis and publish task is set to run after that. The same task succeeds if it is run post completion of SonarQube analysis and publish. The prepare analysis task is set to run towards the start of the pipeline. The specific dotnet task logs also indicate certain issues like -

C:\a\_tool\dotnet\sdk\6.0.300\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3021: Unable to copy file "C:\a\1\s\src\<path_name>.dll" to "bin\Debug\net6.0\<name>.dll". The process cannot access the file 'C:\a\1\s\src\<path_name>.dll' because it is being used by another process.

Hence my question is, is there some limitation/issue due to which SonarQube could hold on to some DLLs until the analysis is complete? If yes, how do we overcome this?

Hello @gischethans

Is this .dll one under the .sonarqube folder?

Could you also please try to check which process holds the reference to the mentioned .dll? Process explorer could help in this investigation.

All the best,