当前位置: 首页 > 知识库问答 >
问题:

SonarQube扫描器执行过程中出错-非法参数异常

方玄天
2023-03-14

当我像错误消息中建议的那样使用-x启动SonarQube扫描器时,我会得到以下结果:

2016-11-14T14:33:27.2720044Z ##[error]15:33:27.238  Unrecognized command line argument: -X
2016-11-14T14:33:27.2720044Z ##[error]15:33:27.261  Expecting at least the following command line argument:
2016-11-14T14:33:27.2730045Z ##[error]- SonarQube project key
2016-11-14T14:33:27.2730045Z ##[error]When connecting to a SonarQube server earlier than version 6.1, the following command line arguments are also required:
2016-11-14T14:33:27.2740046Z ##[error]- SonarQube project name
2016-11-14T14:33:27.2740046Z ##[error]- SonarQube project version
2016-11-14T14:33:27.2750047Z ##[error]The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
2016-11-14T14:33:27.2750047Z ##[error]15:33:27.261  Pre-processing failed. Exit code: 1

我以以下方式启动扫描仪:

SonarQube.Scanner.MSBuild.exe begin /k:ProjectKey /n:ProjectName /v:4.0.70 

结束命令是

SonarQube.Scanner.MSBuild.exe end

Start在end之前被明确地调用。会出什么问题?

共有1个答案

尹光辉
2023-03-14

我也遇到过同样的问题,它可能是由非UTF-8或启用BOM的UTF-8编码引起的,请参见此处:

对包含一些使用非UTF-8编码的C#源文件的Visual Studio解决方案的分析失败

作为等待修复的可能WA,尝试强制源代码编码为UTF-8,如果不够,则显式地将源代码转换为无BOM的UTF-8编码。

 类似资料: