无法使MSARild 2.2.0.24的SonarQube扫描程序工作:在.cs文件

时间:2017-01-04 15:39:25

标签: msbuild sonarqube

我试图使用VS2013(.net 4.5.2)解决方案在TFS 2013上使用sonarqube分析与构建(msbuild 12)一起运行。我已经设置了SonarQube服务器并成功运行了手动扫描。

我使用tfvcTemplate.12.xaml,预编译和后编译脚本指向构建服务器上的sonarqube.scanner.msbuild.exe(d:\ sonarqubeMSbuild ..)以及相应的开始和结束参数。我已启用详细模式来帮助理解问题。

我总是在失败的tfs构建日志上获得以下错误堆栈:

    09:51:40.907 ERROR: Failed to analyze the file: D:\Builds\29\SD\ApplicationDemoTestsUnit_MAN\src\PreuvesDeConcept\TestsUnitaires\Application\CompteBancaire.cs
 09:51:40.907 ERROR: System.UnauthorizedAccessException: Access to the path 'D:\Builds\29\SD\ApplicationDemoTestsUnit_MAN\src\PreuvesDeConcept\TestsUnitaires\Application\CompteBancaire.cs' is denied.
 09:51:40.907 ERROR:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
 09:51:40.907 ERROR:    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
 09:51:40.907 ERROR:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
 09:51:40.907 ERROR:    at SonarAnalyzer.Runner.CompilationHelper.GetSolutionFromFiles(String filePath, Encoding encoding, AnalyzerLanguage language)
 09:51:40.907 ERROR:    at SonarAnalyzer.Runner.Program.RunAnalysis(ScannerAnalyzerConfiguration conf)
 09:51:40.985 ERROR: Error during SonarQube Scanner execution
 java.lang.IllegalStateException: The .NET analyzer failed with exit code: 1 - Verify that the .NET Framework version 4.5.2 at least is installed.

使用进程监视器在构建服务器上验证文件访问错误:

High Resolution Date & Time:    2017-01-04 09:51:40,9043151
Event Class:    File System
Operation:  CreateFile
Result: ACCESS DENIED
Path:   D:\Builds\29\SD\ApplicationDemoTestsUnit_MAN\src\PreuvesDeConcept\TestsUnitaires\Application\CompteBancaire.cs
TID:    5232
Duration:   0.0000914
Desired Access: Generic Read/Write
Disposition:    Open
Options:    Synchronous IO Non-Alert, Non-Directory File, Open No Recall
Attributes: n/a
ShareMode:  None
AllocationSize: n/a

尝试访问该文件的身份是我的构建代理运行的域服务帐户。此帐户具有对文件系统的完全访问权限,并且是构建计算机上的管理员。

对此事的任何想法都将受到高度赞赏!

由于

1 个答案:

答案 0 :(得分:1)

我们要求对文件进行读/写访问,这是我们的错误。这是修复它的相应故障单:https://jira.sonarsource.com/browse/SLVS-1122