Error MSB4018: The "IsTestFileByName" task failed unexpectedly

Hi All,
I’m getting below errors when I’m executing MSBuild Could anyone help me on this.

C:\Program Files (x86)\Jenkins\workspace\Test_Sonar.sonarqube\bin\targets\SonarQube.Integration.targets(231,5): error MSB4018: The “IsTestFileByName” task failed unexpectedly.

C:\Program Files (x86)\Jenkins\workspace\Test_Sonar.sonarqube\bin\targets\SonarQube.Integration.targets(231,5): error MSB4018: System.IO.FileNotFoundException: C:\sonar-scanner-msbuild-4.9.0.17385-net46\SonarQube.Analysis.xml
@Colin @JolyLoic

@Cameron @Colin could you please help me on this?

Hi @duncanp @mickaelcaro could you please help me on this I’m waiting for the solution from last one week.

Hi @SrinivasP

I think that the error is self explaining. The SonarQube.Analysis.xml was not found where it should be. Could you please try to unzip the Scanner again and try a new run ?

Thanks.

Hi @mickaelcaro I have deleted old scanner and downloaded new one and no luck I’m getting now diffrent errors.

CSC : error CS0006: Metadata file ‘C:\Users\siteadmin\AppData\Local\Temp\18.sonarqube\resources\1\SonarAnalyzer.VisualBasic.dll’ could not be found

I have a question Do I need to unzip the file inside the repos or anywhere it will be fine?
Also I’m analyzing .NET and C# code so do I need sonarqube Cli to be installed?

Are you invoking it from it’s executable ? If so, then unzipping it anywhere should be fine if you can invoke it.

The Scanner CLI is embedded into the zip, so no need to download it separately.

We have one solution with .net and C++ projects, and dependencies between them. Is SonarQube supports this with SonarScanner.MSBuild.exe?

When I tried to build the .NET & C++ projects through MSBuild I’m getting error BC30002: Variable not defined error.

Could you please help me on this.

Do you have this error during the MSBuild build itself, or during the SonarQube analysis ?

As we have 2 different scanners for C# and C++ i would preferably go for analyzing your C# projects with the Scanner for MSBuild and the C++ part with the build-wrapper

Mickaël

I’m getting above error when executing the below command.
SonarScanner.MSBuild.exe begin /k:xxxxx /d:sonar.host.url=xxx.xx/d:sonar.verbose=true /d:sonar.login=xxxx

MSBuild.exe “MPBuild.sln” /t:Clean /t:Build /p:Configuration=Debug /p:Platform=“Any CPU” /p:TargetProfile=Local

Is anything I’m doing wrong please let me know.
In single solution we have .Net & C++ projects so in that case I have to execlude the c++ projects from the MSBuild am I right? or any solution to build combined.

Hi @SrinivasP

Sorry for the very late reply.

Are you still facing issues ?

If yes, would be good if you can send me the full logs (ideally in debug mode) of the task where the error occur, that might help to troubleshoot. I can send you a PM if you need to share it privately, just let me know.

Thanks.

Hi @mickaelcaro

The issue is fixed by following below method.

SonarScanner.MSBuild.exe begin /k:xxxxxx /d:sonar.host.url=xxxxxxxxxxxx /d:sonar.verbose=true /d:sonar.login=xxxxxxxxxxxxxxxxxxx

build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory “C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe” SampleBuild.sln “/t:Restore” “/t:Build” /p:Configuration=Debug /p:PreferredToolArchitecture=x64

SonarScanner.MSBuild.exe end /d:sonar.login=xxxxxxxxxxxxx

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.