问题
We are currently calling the runner like this:
D:\BuildTools\MSBSonarQubeRunner-1.0.2\MSBuild.SonarQube.Runner.exe begin /k:"someKey" /n:"someName" /v:"someVersion" /d:sonar.resharper.cs.reportPath="K:\somePath\resharper.xml"
We want to have the output of sonar in K:\.sonarqube
We tried to use the command line arg /d:sonar.working.directory=K:\\.sonarqube
but that didn't work. We also tried setting the working directory in the SonarQube.Analysis.xml like this: <Property Name="sonar.working.directory">K:\.sonarqube\</Property>
That didn't work too ... We need to have it in a top directory, because the sonar runner throws an PathTooLongException (out path is 286 characters long).
Thank you for your help
回答1:
It is not possible to change the working directory of the SonarQube Scanner for MSBuild.
You can however launch the build from another folder, but all 3 steps (begin
, msbuild
and end
) must be launched from that folder:
- k:
- D:\BuildTools\MSBSonarQubeRunner-1.0.2\MSBuild.SonarQube.Runner.exe begin ....
- msbuild /t:rebuild c:\whereever\your\sources\are\Solution.sln
- D:\BuildTools\MSBSonarQubeRunner-1.0.2\MSBuild.SonarQube.Runner.exe end
来源:https://stackoverflow.com/questions/34182934/how-can-i-change-the-working-directory-of-msbuild-sonarqube-runner-exe