晚上好,
我在Jenkins的一个2.1项目中使用了这里的https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild的.Net Core2.0版本:
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核心主机后台进程。如果我杀了这些我可以再建一次..
我读到了有关msbuild的MSBuild /nodereuse:false,但似乎不适用于dotnet核心版本?
发布于 2018-06-21 19:20:04
仅供参考@Nauzet在MSBuild repo:#535的扫描器中为此打开了一个问题。
总结一下:
触发生成阶段,则会发生此问题。
仅供参考,MSBuild扫描程序有几个在构建阶段调用的自定义任务。它们使用被锁定的程序集。定制任务没有什么不寻常之处;它们只是从磁盘上的文件中读取数据。在这一点上,我不相信这是MSBuild扫描器的问题。
发布于 2018-10-05 21:15:46
我们刚刚面对这个问题,并发现它与dotnet和msbuild重用以前的多线程构建留下运行的节点有关。
要避免此问题,请在命令行中使用/nodereuse:false或/nr:false,如下所示:
msbuild /m /nr:false myproject.proj
msbuild /m /nodereuse:false myproject.proj
dotnet restore myproject.sln /nodereuse:false发布于 2019-01-08 20:13:40
我遇到了同样的问题,运行下面的命令解决了这个问题。
dotnet build-server shutdown这是由于重用msbuild节点造成的。我们让msbuild节点保持活动状态,目的是在进行连续构建时节省启动时间。
它也可以通过设置以下环境变量来关闭。
MSBUILDDISABLENODEREUSE=1https://stackoverflow.com/questions/50632277
复制相似问题