title: How to test .NET builds with gitlab-runner locally?
body: <p>I'm trying to test my <code>.gitlab-ci.yml</code> file for a .NET project locally, but am having trouble doing so. To be able to ask a useful question here I've tried to create instructions for a minimal repro, assuming a fully up to date Windows 10 Pro machine with Visual Studio 2017 installed.</p>
  
  <ol>
  <li>Create a new .NET 4.6.2 Console Application "GlabTest" in Visual Studio in the following location: <code>c:\experiments\GlabTest</code></li>
  <li>Package Manager Console: <code>Install-Package NewtonSoft.Json</code></li>
  <li><code>Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(1));</code> as the only line of code in the Main function</li>
  <li><p><code>.gitlab-ci.yml</code> file next to the <code>sln</code> file with this content:</p>
  
  <pre><code>variables:
    RELEASE_FOLDER: 'GlabTest/bin/Release'
    MSBUILD: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe'
  
  stages:
    - build
  
  build_job:
    stage: build
    script:
      - 'nuget restore'
      - '&amp; "$env:MSBUILD" GlabTest.sln /p:Configuration=Release /t:Rebuild'
    artifacts:
      paths:
        - '$env:RELEASE_FOLDER\'
  </code></pre></li>
  <li><p><code>.gitignore</code> with this:</p>
  
  <pre><code>.vs/
  **/[Pp]ackages/*
  [Bb]in/
  [Oo]bj/
  </code></pre></li>
  <li><p><code>git init</code> and <code>git add .</code> and <code>git commit -m "Weeee"</code></p></li>
  <li>Follow <a href="https://docs.gitlab.com/runner/install/windows.html" rel="nofollow noreferrer">these instructions</a> and download to <code>c:\gl\gitlab-runner-windows-amd64.exe</code></li>
  <li>Open PowerShell, go to the <code>sln</code> folder</li>
  <li><code>&amp; 'C:\gl\gitlab-runner-windows-amd64.exe' exec shell build_job</code></li>
  </ol>
  
  <p>This will spit out all sorts of errors:</p>
  
  <ul>
  <li>"<code>Since gitLab Runner 10.0 this command is marked as DEPRECATED</code>" without any hints on how to migrate away from <code>exec</code></li>
  <li>Cloning the repo into a subfolder of itself (<code>.../GlabTest/builds/0/project-0</code>)</li>
  <li>"<code>&amp; was unexpected at this time.</code>" near the end</li>
  <li><p>all sorts of output issues, e.g. the last line is:</p>
  
  <pre><code>[31;1mERROR: Job failed: exit status 255
  </code></pre></li>
  </ul>
  
  <p>Before I dive deeper into a "DEPRECATED" command I should probably step back and ask: what is the recommended way to iterate locally a <code>.gitlab-ci.yml</code> file with Powershell build on a Windows machine?</p>