Search code examples
c#.netmsbuildsonarqube

SonarQube running .net project error : MsBuild.exe /t:Rebuild 'MsBuild.exe' is not recognized as an internal or external command


I have installed SonarQube, I am able to run .net core projects and analyse the codes, however I am trying to run on a .net project its not working,

steps I followed:

1- I created a project in SonarQube and on build I selected .net and build tool .Net framework

2- In root of my .net application codes or solutions I run the generated commands

 SonarScanner.MSBuild.exe begin /k:"ULO-DEVProject" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="sqp_4ee1f72f8456599998db59ffe007afbeb2e73284"

this run successfull

when I run: MsBuild.exe /t:Rebuild

I get below error:

'MsBuild.exe' is not recognized as an internal or external command,
 operable program or batch file.

Solution

  • I solved my problem by adding path to system env variable for me the path looked like this. make sure you find your visual studio bin folder where MSBuild.exe exists.

     C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin