当我使用声纳运行TFS 2013时,我收到以下错误:No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
消息:TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'.
我用:
我已按照" SonarQube现有TFS环境安装指南中的说明进行操作.pdf"。
任何帮助?
谢谢。
记录:
SonarQube Analysis Summary Analysis failed for SonarQube project "WpfApplication2", version 1.0 Product projects: 0, test projects: 0 Invalid projects: 0, skipped projects: 0, excluded projects: 0 Résumé Debug | x86 0 erreur(s), 1 avertissement(s) $/Essai2/WpfApplication2/WpfApplication2.sln - 0 erreur(s), 1 avertissement(s), Afficher le fichier journal C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln.metaproj : The specified solution configuration "Debug|x86" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration. $/Essai2/WpfApplication2/WpfApplication2.sln compilé Aucun résultat des tests Aucun résultat de couverture du code Autres erreurs et avertissements 2 erreur(s), 0 avertissement(s) 01:45:52: No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built. Exception Message: TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
这是诊断(我截断了源检出部分):
Compile, Test and Publish00:00:46 Run optional script before MSBuild00:00:08 InputsEnvironmentVariables: Enabled: True Arguments: /key:WpfApplication2 /name:WpfApplication2 /version:1.0 FilePath: C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe OutputsResult: 0 C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe /key:WpfApplication2 /name:WpfApplication2 /version:1.0 Pre-processing (3 arguments passed) Using environment variables to determine the download directory... Using environment variable 'TF_BUILD_BUILDDIRECTORY', value 'C:\Builds\1\Essai2\WpfApplication2' Creating the analysis bin directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin SonarQube server url: http://localhost:9000 Downloading SonarQube.MSBuild.Runner.Implementation.zip from http://localhost:9000/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip to C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.Runner.Implementation.zip Executing file C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.PreProcessor.exe Args: "/key:WpfApplication2" "/name:WpfApplication2" "/version:1.0" Working directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin Timeout (ms):300000 Process id: 4168 01:45:11: The path to the sonar-runner.properties file was not supplied on the command line. Attempting to locate the file... 01:45:11: Located the runner properties file: C:\sonar-runner-2.4\conf\sonar-runner.properties 01:45:11: Legacy TeamBuild environment detected 01:45:11: Creating config and output folders... 01:45:11: Removing the existing directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf 01:45:11: Creating directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf 01:45:11: Removing the existing directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\out 01:45:11: Creating directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\out Generating the FxCop ruleset... 01:45:14: Saving the config file to C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf\SonarQubeAnalysisConfig.xml Process returned exit code 0 Run MSBuild00:00:12 InputsProjectsToBuild: String[] Array MSBuildMultiProc: True Verbosity: Normal ToolPlatform: Auto Targets: RunCodeAnalysis: AsConfigured CommandLineArguments: /p:SkipInvalidConfigurations=true /p:Configuration=Debug /p:Platform="Any CPU" ConfigurationsToBuild: String[] Array OutputLocation: SingleFolder Enabled: True ToolVersion: CleanBuild: True OutDir: RestoreNuGetPackages: True C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\nuget.exe restore "C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln" -NonInteractive C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true /p:Configuration=Debug /p:Platform="Any CPU" /m /p:OutDir="C:\Builds\1\Essai2\WpfApplication2\bin\\" /p:Configuration="Debug" /p:Platform="x86" /p:VCBuildOverride="C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln.x86.Debug.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/52;IgnoreDuplicateProjects=False;InformationNodeId=12;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;LogProjectNodes=True;LogWarnings=True;TFSUrl=http://localhost:8080/tfs/DefaultCollection;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="dbda6e4d-d5bc-4eed-8b3e-6cc79e3721cc,vstfs:///Build/Build/52" /p:BuildLabel="WpfApplication2_20150615.3" /p:BuildTimestamp="Mon, 15 Jun 2015 11:44:59 GMT" /p:BuildSourceVersion="LWpfApplication2_20150615.3@$/Essai2" /p:BuildDefinition="WpfApplication2" Run optional script after MSBuild00:00:00 InputsEnvironmentVariables: Enabled: True Arguments: FilePath: OutputsResult: 0 Run optional script before Test Runner00:00:00 InputsEnvironmentVariables: Enabled: True Arguments: FilePath: OutputsResult: 0 Run VS Test Runner00:00:00 InputsTestSpecs: BuildParameter[] Array Enabled: False ConfigurationsToTest: String[] Array OutDir: This activity was not run since its Enabled property was set to False. Run optional script after Test Runner00:00:25 InputsEnvironmentVariables: Enabled: True Arguments: FilePath: C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe OutputsResult: 0 C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe Post-processing (no arguments passed) Using environment variables to determine the download directory... Using environment variable 'TF_BUILD_BUILDDIRECTORY', value 'C:\Builds\1\Essai2\WpfApplication2' Executing file C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.PostProcessor.exe Args: Working directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin Timeout (ms):3600000 Process id: 6548 01:45:28: Legacy TeamBuild environment detected 01:45:28: Loading the SonarQube analysis config from C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf\SonarQubeAnalysisConfig.xml 01:45:28: Legacy TeamBuild environment detected 01:45:28: Attempting to locate the CodeCoverage.exe tool... 01:45:28: Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe 01:45:28: Fetching code coverage report information from TFS... 01:45:28: Connecting to TFS... 01:45:29: Fetching build information... 01:45:30: Fetch code coverage report info... 01:45:52: Operation timed out, Elapsed time (ms): 20358 01:45:52: ...done. 01:45:52: No code coverage reports were found for the current build. 01:45:52: Generating SonarQube project properties file to C:\Builds\1\Essai2\WpfApplication2\sqtemp\out\sonar-project.properties 01:45:52: No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built. 01:45:52: Writing processing summary to C:\Builds\1\Essai2\WpfApplication2\sqtemp\out\ProjectInfo.log 01:45:52: Generation of the sonar-properties file failed. Unable to complete SonarQube analysis. 01:45:52: Updating the TeamBuild summary... Process returned exit code 1 Exception Message: TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Handle Exception
答案 0 :(得分:7)
提供以下信息是为了帮助解决MSBuild.Runner 0.9版的问题。在以后的版本中,行为可能会发生变化。
最严重的配置问题将导致出现在“构建摘要”页面上的警告或错误。如果没有报告错误或警告,请检查TFS TeamBuild诊断输出(单击"诊断"链接到Visual Studio中构建摘要报告的顶部)。处理前和处理后的步骤都记录了大量信息,以帮助诊断问题。
该部分应如下所示:
SonarQube Analysis Summary
Analysis failed for SonarQube project "Simple console app", version 1.0
Product projects: 4, test projects: 2
Invalid projects: 0, skipped projects: 0, excluded projects: 0
如果该部分没有出现在构建摘要页面上,那么构建代理,构建定义或两者都存在配置问题。请阅读以下步骤以进一步诊断这些步骤。
1.1检查摘要中报告的项目数
如果未找到任何项目,则表明在构建期间未导入和使用集成目标。
如果所有项目都标记为无效,则可能是您要构建多个配置,例如[发布或调试] | [x86或x64]。您还应该收到一条错误消息,指出找不到ProjectInfo.xml文件。
您一次只能分析一个配置。如果要分析发布和调试版本,则需要使用不同的SonarQube项目ID为每个版本创建单独的构建定义。
诊断日志将包含有关项目无效原因的更多信息,这通常是因为项目没有guid,或者guid不是唯一的。非唯一guid的正常原因是您正在构建多个配置,例如发布和调试。
诊断输出应包含类似于以下内容的输出:
在MSBuild
之前运行可选脚本C:\ SonarQube \ bin \ SonarQube.MSBuild.Runner.exe / key:MyProject / name:" My Project" /version:1.0
预处理(传递3个参数)
如果没有,请检查您是否在"预构建脚本"中正确调用了SonarQube.MSBuild.Runner.exe。步骤在构建定义中。一个简单的错误就是通过设置"构建后"将脚本参数放在错误的框中。相反,属性(无用,UI中的Post-build字段出现在Pre-build字段之前)。
诊断输出应包含类似于以下内容的输出:
在Test Runner
之后运行可选脚本C:\ SonarQube \ BIN \ SonarQube.MSBuild.Runner.exe
后处理(没有参数传递)
如果没有,请检查您是否在"测试后脚本"中正确调用了SonarQube.MSBuild.Runner.exe。步骤在构建定义中。
如果正确执行构建前和构建后步骤,请检查诊断输出的其余部分,以获取有关什么不起作用的线索。请特别注意来自前处理器和后处理器的有关他们正在写入的目录和文件的消息。
分析过程在v0.9中名为SQTemp的文件夹下的build目录下创建临时文件。 检查文件夹的内容有助于确定分析失败的阶段。
预期的文件夹如下:
bin:此文件夹包含分析目标和二进制文件。它由SonarQube.MSBuild.Runner.exe创建,它从SonarQube服务器下载文件。如果此文件夹不存在或为空,则分析在很早的阶段就会失败,并且应该出现警告或错误。检查SonarQube服务器上是否正确安装了C#插件v4,以及自插件安装以来SonarQube已重新启动。
conf:此文件夹是在预处理期间创建的,包含从SonarQube服务器下载的设置。如果SonarQube中有任何活动的FxCop规则,则该文件夹应包含FxCop规则集。
out:在MSBuild阶段填充此文件夹。每个正在构建的项目应包含一个文件夹。它还将包含生成的sonar-project.properties文件,该文件将传递给声纳 - 跑步者。如果文件夹为空,则可能无法正确导入SonarQube.Integration.targets。 找到错误消息"没有找到ProjectInfo.xml文件"通常会出现在这种情况下。 ProjectInfo.xml文件由目标" WriteSonarQubeData"生成。在SonarQube.Integration.targets中,接下来要检查的是正确导入SonarQube.Integration.targets并且正在执行预期的目标。
首先,仔细检查SonarQube.Integration.ImportBefore.targets文件的安装:
如果目标安装正确,那么您需要将MSBuild日志记录的详细程度增加到诊断并再次构建,以便您可以检查详细的MSBuild输出。不幸的是,在TeamBuild 2013下运行时,似乎并不是一种简单的方法来增加MSBuild日志的详细程度。您可以生成一个包含更多详细信息的附加日志文件,但是您需要访问构建代理程序拿起日志文件。
使用更详细的信息创建MSBuild日志:
如果正在执行SonarQube.Intergration.ImportBefore.targets,则会有一个日志条目说明" SonarQubeImportBeforeInfo"目标已执行。应该有一些输出消息说明文件" SonarQube.Integration.targets"找到与否。
ProjectInfo.xml文件由目标" WriteSonarQubeProjectData"编写。日志应显示此目标已执行,并且" WriteProjectInfoFile"任务已执行。如果没有,日志应该知道为什么跳过目标。