I am in a Team that currently uses VS2013, so my installation is MSBuild12. I installed FXCop10. I installed MSBuild14. I installed SonarQube Scanner for MSBuild 2.1.
I run SonarQube Version 5.6 in the demo mode. I have all rules enables and can analyse using the following batch script:
<!-- language: lang-sh-->
@echo off
REM Set FxCop10Directory="C:\Program Files (x86)\Microsoft Fxcop 10.0\"
REM Set FxCop10="C:\Program Files (x86)\Microsoft Fxcop 10.0\FxCopCmd.exe"
Set ScannerDirectory="D:\Programs\sonar-scanner-2.6.1\bin\"
Set MSBuild12="C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
Set MSBuild14="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
Set Runner="MSBuild.SonarQube.Runner.exe"
Set Key="DEMO2016"
Set Name="SonarQube Internal Demo"
Set Version="0.0.0.0"
PATH=%PATH%;%ScannerDirectory%
call %Runner% begin /k:%Key% /n:%Name% /v:%Version%
call %MSBuild14% /t:Rebuild
call %Runner% end
pause
When I try to upgrade to MSBuild14 by changing my call to call %MSBuild14% /t:Rebuild
, I get an error.
error : FxCop must be installed when some of its rules are enabled in the SonarQube quality profile. FxCop is included as part of Visual Studio.
VS2013 came with another Version of FXCop.
How can I control the Version used by the MSBuild.SonarQube.Runner
?
How do I set up FxCop10 for the MSBuild.SonarQube.Runner
?
I do not know why MSBuild12 initially worked for me. I had to import the development environment to make things work on my system.
<!-- language: none-->
@echo off
echo.
echo Setup References
Set ScannerDirectory="D:\Programs\sonar-scanner-2.6.1\bin\"
Set MSBuild14="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
Set Runner="MSBuild.SonarQube.Runner.exe"
Set vcvars="C:\LegacyApp\VisualStudio2013\VC\vcvarsall.bat"
echo.
echo Setup Runner Parameters
Set Key="DEMO2016"
Set Name="SonarQube Internal Demo"
Set Version="0.0.0.0"
echo.
echo Create Environment
PATH=%PATH%;%ScannerDirectory%
call %vcvars%
echo.
echo Runner Begin
call %Runner% begin /k:%Key% /n:%Name% /v:%Version%
echo.
echo MSBuild Rebuild
call %MSBuild14% /t:Rebuild
echo.
echo Runner End
call %Runner% end
pause
The output shows where the Currently used FxCop Version is:
<!-- language: none-->
Running Code Analysis...
C:\LegacyApp\VisualStudio2013\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe
Executing that file in a command prompt returns its Version.