Unable to setup sonarscan using Jenkin declarative pileline for .net application

Must-share information (formatted with Markdown):

  • Version: sonarqube plugin 2.4.1
    Trying to achieve: Trying to configure Sonar scan using Jenkin pipeline rather than calling from Jenkin build
  • what have you tried so far to achieve this : I am able to setup sonarqubescan using Jenkin build however I want to setup same thing in my Jenkin declarative pipeline . so far I have created
    “sonar-project.properties” with below settings and calling the same from pipeline

command to call from pipeline:

   stage('Sonarqube analysis') {
    steps {
        tool name: 'SonarQube', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
         withSonarQubeEnv('SonarQube') {
         bat "sonar-project.properties.bat" 
    }  }   }

Error: Unable to recognize any of the above command like
‘sonar.projectKey’ is not recognized as an internal or external command,

much appreciate for any direction/pointers.

Hi @cpsing1983,

I’m not familiar with the Jenkins pipeline syntax, but it looks like you are telling Jenkins to execute the sonar-project.properties file as if it were are a batch file, which it isn’t.

This article might help.