title: Gitlab CI Runner Predefined Macro MSBuild
body: <p>Hi I'm trying to use environmental variables as part of the MSBuild process on a Gitlab runner setup to pass the CI_PIPELINE_ID and CI_COMMIT_SHA to build the application with an increment build id and commit sha to track the binaries version.</p>
  
  <p>My .gitlab-ci.yml is configured as below:</p>
  
  <pre><code>variables:
    Solution: Project.sln
  
  before_script:
    - "echo off"
    - 'call "%VS140COMNTOOLS%\vsvars32.bat"'
    - echo.
    - set
    - echo.
    - echo %HALCONROOT%|find "13" &gt;nul
    - if errorlevel 1 (echo not13) else (set HALCONVERSION=HALCON_13)
  
  stages:
    - build
  
  build:
    stage: build
    script:
    - echo building...
    - 'msbuild.exe /p:Configuration="Release" /p:Platform="x64" "%Solution%"'
    tags:
    - "HALCON 13"
    except:
    - tags
  </code></pre>
  
  <p>What do I need to do to access the environmental variables like this in my c++ project?</p>
  
  <pre><code>#ifndef CI_COMMIT_SHA
  #define COMMIT_SHA                  0
  #else
  #define COMMIT_SHA                  CI_COMMIT_SHA
  #endif
  </code></pre>