title: DockerFile: Passing an ARG to dotnet build for build-configuration
body: <p>I'm not able to utilize a Docker ARG in my DockerFile -- specifically when building a .net Core project:</p>
  
  <pre><code>FROM microsoft/dotnet:2.2-sdk-nanoserver-1809 AS build
  ARG target_configuration=Debug
  WORKDIR /src
  COPY MyProject/MyProject.csproj MyProject/
  RUN dotnet restore MyProject/MyProject.csproj
  COPY . .
  WORKDIR /src/MyProject
  RUN dotnet build --configuration $target_configuration --no-restore -o /app MyProject.csproj
  </code></pre>
  
  <p>The <strong>'$target_configuration'</strong> is not substituted. I've tried various combinations of ${xx}, "$xx", "${xx}", etc, but I'm not winning.
  FWIW, the message I get in this case is:</p>
  
  <blockquote>
    <p>warning MSB3052: The parameter to the compiler is invalid,
    '/define:$TARGET_CONFIGURATION'</p>
  </blockquote>
  
  <p>I'm aware of the limitation of ARGs not being available during container run-time (and associated need for an ENV variable), as well as the ARG not being available during build when defined BEFORE the FROM statement, however these are not applicable here (I believe).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Docker Environment:</p>
  
  <pre><code>Server: Docker Engine - Community
  Engine:
    Version:          18.09.2
    API version:      1.39 (minimum version 1.24)
    Go version:       go1.10.6
    Git commit:       6247962
    Built:            Sun Feb 10 04:28:48 2019
    OS/Arch:          windows/amd64
    Experimental:     false
  </code></pre>
  
  <hr>
  
  <p><strong><em>EDIT:</em></strong></p>
  
  <p>(TL;DR) <strong>Use %var% for Windows images</strong></p>
  
  <p>Docker RUN runs within a specified container, which means that the shell that command is running in affects how variable substitution is done. So for Windows containers, use %var%</p>
  
  <p><a href="https://forums.docker.com/t/unable-to-consume-arg-or-env-variables-in-run-commands/25467?u=ive" rel="nofollow noreferrer">This</a> thread in the Docker-Forum has a little more</p>