title: How do I use Gitlab variables with SonarQube.Scanner.MSBuild.exe inside of a gitlab-ci.yml
body: <p>When i try to use SonarQube.Scanner.MSBuild.exe with switches like:</p>
  
  <pre><code>SonarQube.Scanner.MSBuild.exe /k:%CI_COMMIT_REF_NAME% /n:%CI_COMMIT_REF_NAME%
  </code></pre>
  
  <p>The log dump gives me problems for having %CI_COMMIT_REF_NAME%. It's as if they don't exist or that they can't be found.</p>
  
  <p>I also see this line at the end of the file:</p>
  
  <pre><code>'GitLab Commit Issue Publisher' skipped because one of the required properties is missing
  </code></pre>
  
  <p>Here is my SonarQube.Analysis.xml file</p>
  
  <pre><code>&lt;SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1"&gt;
   &lt;!-- The sonarqube server address --&gt;
    &lt;Property Name="sonar.host.url"&gt;http://server.com:1234&lt;/Property&gt;
  
        &lt;Property Name="sonar.sourceEncoding"&gt;UTF-8&lt;/Property&gt;      
  
        &lt;!-- I have no idea if anything below this line works --&gt;
      &lt;!--   &lt;Property Name="sonar.projectName"&gt;Master&lt;/Property&gt;  Should be set in job of the gitlab yml
        &lt;Property Name="sonar.projectKey"&gt;Master&lt;/Property&gt; Should be set in job of the gitlab yml --&gt;
        &lt;Property Name="sonar.exclusions"&gt;folder\**&lt;/Property&gt;
        &lt;Property Name="sonar.sources"&gt;.&lt;/Property&gt;
        &lt;Property Name="sonar.verbose"&gt;true&lt;/Property&gt;
       &lt;!--  &lt;Property Name="sonar.scanner.dumpToFile"&gt;somethingWentWrong.txt&lt;/Property&gt; --&gt;
        &lt;Property Name="sonar.analysis.mode"&gt;issues&lt;/Property&gt;
  
  
        &lt;!--
      this is only for forced authentication. the group "everyone" on the server has execute permission so you don't need to fill this out.
        &lt;Property Name="sonar.login"&gt;&lt;/Property&gt;
        &lt;Property Name="sonar.password"&gt;&lt;/Property&gt;
        --&gt;
  
  
      &lt;/SonarQubeAnalysisProperties&gt;
  </code></pre>
  
  <p>here is the command sequence I use to call SonarQube.Scanner.MSbuild.exe in the gitlab-ci.yml job:</p>
  
  <pre><code> - SonarQube.Scanner.MSBuild.exe begin /k:doesthiswork /n:doesthiswork 
   - MSBuild.exe /t:Rebuild directory\Solution.sln
   - SonarQube.Scanner.MSBuild.exe end
  </code></pre>
  
  <p>What do I not understand about using Gitlab predfined variables in SonarQube.Scanner.MSBuild.exe calls inside of Gitlab-ci.yml?</p>
  
  <p>gitlab variables: <a href="https://docs.gitlab.com/ee/ci/variables/#predefined-variables-environment-variables" rel="nofollow noreferrer">https://docs.gitlab.com/ee/ci/variables/#predefined-variables-environment-variables</a></p>