sonarqube - dotnet.exe 锁定 SonarScanner.MSBuild.Common.dll
问题描述
晚上好,
我在 Jenkins 的 2.1 项目中使用 .Net Core 2.0 版本https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild :
withSonarQubeEnv('SonarQubeMain') {
bat "dotnet ${globals.SONAR_QUBE_MSBUILD_PATH}\\SonarScanner.MSBuild.dll begin /k:\"${globals.SONAR_QUBE_PROJECT}\" /d:sonar.host.url=${globals.SONAR_HOST_URL} /d:sonar.cs.xunit.reportsPaths=\"XUnit.xml\" /d:sonar.cs.opencover.reportsPaths=\"coverage.xml\"
}
bat "dotnet build --version-suffix ${env.BUILD_NUMBER}"
dir('test/mytestprojecthere') {
bat 'D:\\OpenCover\\OpenCover.Console.exe -target:"c:\\Program Files\\dotnet\\dotnet.exe" -targetargs:"xunit --no-build -xml XUnit.xml" -output:coverage.xml -oldStyle -filter:"-[*Tests*]*" -register:user'
}
withSonarQubeEnv('SonarQubeMain') {
bat "dotnet ${globals.SONAR_QUBE_MSBUILD_PATH}\\SonarScanner.MSBuild.dll end"
}
它在第一次构建时有效,但在下一次构建时失败:
Failed to create an empty directory 'D:\Jenkins\workspace\xxxxxxxx\.sonarqube'.
Please check that there are no open or read-only files in the directory and that you have the necessary read/write permissions.
Detailed error message: Access to the path 'SonarScanner.MSBuild.Common.dll' is denied.
并检查我的 Windows 服务器,我可以看到多个 .Net Core 主机后台进程。如果我杀了这些,我可以再次建造..
我阅读了有关 MSBuild 的 msbuild/nodereuse:false
但似乎不适用于 dotnet 核心版本?
解决方案
我们刚刚遇到了这个问题,发现它与 dotnet 和 msbuild 对先前多线程构建留下的节点的重用有关。
为避免此问题,请在命令行中使用/nodereuse:false
或/nr:false
,如下所示:
msbuild /m /nr:false myproject.proj
msbuild /m /nodereuse:false myproject.proj
dotnet restore myproject.sln /nodereuse:false
推荐阅读
- python - 在函数中传递一个可变对象作为默认参数 - 奇怪的行为
- python - 自定义 ViewSet 操作的 DRF 文档中的架构不正确
- mysql - MySql 语句在 .bat 文件中不起作用,但在 MySql 中运行良好
- java - 我的程序因为 IOException 而输出警告?
- java - 在一个按钮 JFrame 上有多个事件监听器
- regex - 带有针对 vs 代码片段的捕获组的正则表达式
- c++ - 等待并通知 C++ 中的多线程
- javascript - 将数据从输入发送到 custom.js 并根据 custom.js 文件中的输入进行计算
- php - 循环某件事 10 次,然后增加一个值并重复该过程总共 10 次?
- jquery - 如何在 JQuery 中获取服务器当前日期和时间