anchor.diff:  SET BuildPostfix=
   CALL :Build %*
   
  -IF NOT '%ErrorLevel%'=='0' (
  -    GOTO :AfterBuild
  +IF NOT [!ERRORLEVEL!]==[0] (
  +    GOTO AfterBuild
   )
   
   POPD
  
positive.code: SETLOCAL
  SETLOCAL ENABLEDELAYEDEXPANSION
  
  IF NOT DEFINED VisualStudioVersion (
      IF DEFINED VS140COMNTOOLS (
          CALL "%VS140COMNTOOLS%\VsDevCmd.bat"
          GOTO :EnvSet
      )
  
      ECHO Error: build.cmd requires Visual Studio 2015.
      SET ERRORLEVEL=1
      GOTO :Exit
  )
  
  :EnvSet
  SET BuildProj=%~dp0All.sln
  SET Configuration=%1
  IF '%Configuration%'=='' (
      SET Configuration=Release
  )
  SET Environment=%2
  IF '%Environment%'=='PROD' (
      ECHO Updating version for PROD environment
      CALL UpdateVersion.cmd
  
      IF NOT '!ERRORLEVEL!'=='0' (
          ECHO ERROR: Error occurs when updating version
          GOTO :Exit
      )
  )
  
  :: Check if DNU exists globally
  :: DNU is OPTIONAL
  WHERE dnu >NUL
  IF NOT '%ERRORLEVEL%'=='0' (
      ECHO ERROR: DNU is not successfully configured.
      ECHO ERROR: Please follow http://docs.asp.net/en/latest/getting-started/installing-on-windows.html#install-the-net-version-manager-dnvm to install dnvm.
      ECHO ERROR: If dnvm is installed, use `dnvm list` to show available dnx runtime, and use `dnvm use` to select the default dnx runtime
      GOTO :Exit
  )
  
  :: Update template before build
  ECHO Updating template
  CALL UpdateTemplate.cmd
  
  IF NOT '!ERRORLEVEL!'=='0' (
      ECHO ERROR: Error occurs when updating template
      GOTO :Exit
  )
  
  :: Restore packages for .csproj projects
  
negative.code: ECHO Exit Code: %BuildErrorLevel%
  SET ERRORLEVEL=%BuildErrorLevel%
  
  GOTO Exit
  
  :Build
  %BuildPrefix% msbuild "%BuildProj%" /p:Configuration=%Configuration% /nologo /maxcpucount:1 /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=d;LogFile="%BuildLog%"; %BuildPostfix%
  