C# 在不同的文件夹中可能会产生不同的结果
更新1: 它实际上与构建服务器无关,我已经将我的repo签出到一个新文件夹中,并且可以观察到相同的行为,因此它肯定不是版本问题。我比较了.sonarqube文件夹,没有发现任何异常。从另一个位置建造时,是什么原因导致一个csproj的结果被忽略 原始问题: 我正在为一个.net项目(1.sln,2.csproj)设置sonarqube,当我在我的机器上运行分析时,所有文件都被分析了,我得到了一份不错的报告 当我在新的构建服务器上运行时,只上传其中一个.csproj的结果 我已经验证了msbuild和sonar scanner的相同版本 我在输出中看到的一些差异是:C# 在不同的文件夹中可能会产生不同的结果,c#,sonarqube,devops,sonarqube-scan,C#,Sonarqube,Devops,Sonarqube Scan,更新1: 它实际上与构建服务器无关,我已经将我的repo签出到一个新文件夹中,并且可以观察到相同的行为,因此它肯定不是版本问题。我比较了.sonarqube文件夹,没有发现任何异常。从另一个位置建造时,是什么原因导致一个csproj的结果被忽略 原始问题: 我正在为一个.net项目(1.sln,2.csproj)设置sonarqube,当我在我的机器上运行分析时,所有文件都被分析了,我得到了一份不错的报告 当我在新的构建服务器上运行时,只上传其中一个.csproj的结果 我已经验证了msbuil
INFO: Index files
INFO: 84 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: SCM provider for this project is: git
INFO: 39 files to be analyzed
INFO: 0/39 files analyzed
INFO: Index files
INFO: 0 files indexed
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor C# [csharp]
WARNING: WARN: * ${filename}.cs
WARNING: WARN: * ${filename}.cs
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\0\output-cs'
WARNING: WARN: * ${filename}.cs
// 5 more files
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\1\output-cs'
WARNING: WARN: * ${filename}.cs
// 18 more files
WARNING: WARN: This may lead to missing/broken features in SonarQube
INFO: Importing 2 Roslyn reports
INFO: Sensor C# [csharp] (done) | time=5245ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=143ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=5ms
INFO: 7 files had no CPD blocks
INFO: Calculating CPD for 71 files
INFO: CPD calculation finished
INFO: Analysis report generated in 3159ms, dir size=468 KB
INFO: Analysis reports compressed in 881ms, zip size=256 KB
INFO: Analysis report uploaded in 287ms
INFO: ANALYSIS SUCCESSFUL, you can browse ${sonarUrl}
生成服务器:
INFO: Index files
INFO: 86 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=2ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: Index files
INFO: 0 files indexed
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: Sensor C# [csharp]
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\0\output-cs'
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\1\output-cs'
INFO: Importing 2 Roslyn reports
INFO: Sensor C# [csharp] (done) | time=652ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=85ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=0ms
INFO: 1 file had no CPD blocks
INFO: Calculating CPD for 2 files
INFO: CPD calculation finished
INFO: Analysis report generated in 2326ms, dir size=234 KB
INFO: Analysis reports compressed in 268ms, zip size=116 KB
INFO: Analysis report uploaded in 95ms
INFO: ANALYSIS SUCCESSFUL, you can browse ${sonarUrl}
INFO: Index files
INFO: 84 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: SCM provider for this project is: git
INFO: 39 files to be analyzed
INFO: 0/39 files analyzed
INFO: Index files
INFO: 0 files indexed
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor C# [csharp]
WARNING: WARN: * ${filename}.cs
WARNING: WARN: * ${filename}.cs
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\0\output-cs'
WARNING: WARN: * ${filename}.cs
// 5 more files
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\1\output-cs'
WARNING: WARN: * ${filename}.cs
// 18 more files
WARNING: WARN: This may lead to missing/broken features in SonarQube
INFO: Importing 2 Roslyn reports
INFO: Sensor C# [csharp] (done) | time=5245ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=143ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=5ms
INFO: 7 files had no CPD blocks
INFO: Calculating CPD for 71 files
INFO: CPD calculation finished
INFO: Analysis report generated in 3159ms, dir size=468 KB
INFO: Analysis reports compressed in 881ms, zip size=256 KB
INFO: Analysis report uploaded in 287ms
INFO: ANALYSIS SUCCESSFUL, you can browse ${sonarUrl}
生成服务器:
INFO: Index files
INFO: 86 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=2ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: Index files
INFO: 0 files indexed
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
INFO: Sensor C# [csharp]
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\0\output-cs'
INFO: Importing results from 6 proto files in '${projectDir}\.sonarqube\out\1\output-cs'
INFO: Importing 2 Roslyn reports
INFO: Sensor C# [csharp] (done) | time=652ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=85ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=0ms
INFO: 1 file had no CPD blocks
INFO: Calculating CPD for 2 files
INFO: CPD calculation finished
INFO: Analysis report generated in 2326ms, dir size=234 KB
INFO: Analysis reports compressed in 268ms, zip size=116 KB
INFO: Analysis report uploaded in 95ms
INFO: ANALYSIS SUCCESSFUL, you can browse ${sonarUrl}
我使用以下命令运行分析:
SonarQube.Scanner.MSBuild.exe begin /k:"key" /d:sonar.host.url="url" /d:sonar.login="token"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end /d:sonar.login="token"
尝试触发第二个命令,如下所示 MSBuild.exe 1.sln/t:重新生成 检查有多少项目是该解决方案的一部分。
2.csproj应该是1的一部分。sln解决了它,MsBuild对文件夹名不区分大小写,Sonarqube是 我的解决方案文件引用了
My.Project1/My.Project1.csproj
但在源代码管理中,文件夹名为My.Project1/My.Project1.csproj
不知怎的,在我的本地机器上,我有了工作文件夹的名称