We are moving with our organization from SonarQube to SonarCloud for all our C# projects. We are a big fan of the PR integration feature in combination with Azure DevOps and till now everything went well for the projects that we’ve converted. However we have encountered a strange build issue on one of our largest (and oldest) code bases (C#, .Net 4.6.1 Full Framework) after enabling SonarCloud. We receive
Error MSB303: Could not copy file as shown on the image below
This error pop ups every time for this project with SonarCloud enabled and is the same on every retry. We have not encountered this issue with our on-premise SonarQube for this project.
Build Steps & Logs
We started from a working release build of our code base that builds perfectly on our local machine and on the build server with the following configuration
SonarCloud steps disabled:
- Set Assembly Version
- NuGet Restore
Prepare Analysis Configuration(disabled)
- Visual Studio Build
- Test Assemblies MsTest
Run Code Analysis(disabled)
But as soon as we
enable the SonarCloud build steps, the error pops up. I have investigated the build logs of both versions of the builds and compared them but I don’t see the problem that causes this issue. I have checked the build server too and the files are indeed not present in the specified folders. The issue starts with the copy action of the app.config file that goes wrong:
2018-11-09T12:40:55.0968861Z Copying file from "app.config" to "..\bin\Release\HR.Services.Core.Integration.dll.config".
2018-11-09T12:40:55.1177770Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4187,5): Error MSB3030: Could not copy the file "obj\Release\HR.Services.Core.Integration.dll" because it was not found.
2018-11-09T12:40:55.1184773Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4187,5): error MSB3030: Could not copy the file "obj\Release\HR.Services.Core.Integration.dll" because it was not found. [D:\Agent01\_work\9\s\src\HR.Services.Core.Integration\HR.Services.Core.Integration.csproj]
2018-11-09T12:40:55.1815864Z Done Building Project "D:\Agent01\_work\9\s\src\HR.Services.Core.Integration\HR.Services.Core.Integration.csproj" (default targets) -- FAILED.
I can provide the detailed builds logs in a pm if this can help with the analysis.
Can you help me with the analysis of this issue?
Thanks in advance!