Issues with running MSBuild SonarScanner and MSBuild project with npm install

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

MSBuild SonarScanner 4.1.1

  • what are you trying to achieve

I have a project that contains javascript code and uses angularjs and npm as part of the MSBuild execution. Within my .csproj file, I have a targets defined for executing npm install and ng build and my solution file references this project. When I tried to run:

MSBuild.exe begin /k:sonar.project.key /d:sonar.branch= /d:sonar.login=
msbuild .sln
MSBuild.exe end

However, we are getting an error:

"The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects. Possible causes:
1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards are supported.
3. The begin, build and end steps have not all been launched from the same folder.
4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln) "

  • what have you tried so far to achieve this

I’ve validated that the project is being built between the begin and end steps. Also I’ve validated we are using MSBuild 14.0.27530.0. In addition, I’ve validated that this is all being executed within the same folder. And finally, I’ve confirmed that we have a ProjectGuid and provided a solution file. However, none of this seems to have resolved the issue.

Thank you for your help!