title: Pass variable to nuspec with dotnet pack
body: <p>When using dotnet pack, how do I pass a variable to my nuspec file?</p>
  
  <p>I am trying to pass the version.  Here is the nuspec:</p>
  
  <pre><code>&lt;package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"&gt;
      &lt;metadata&gt;
          &lt;!-- Required elements--&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;version&gt;$PackageVersion$&lt;/version&gt;
          &lt;description&gt;1&lt;/description&gt;
          &lt;authors&gt;1&lt;/authors&gt;
      &lt;/metadata&gt;
  &lt;/package&gt;
  </code></pre>
  
  <p>And here is my command:</p>
  
  <blockquote>
    <p>dotnet.exe pack  /p:NuspecFile=./App.Nuspec
    /p:PackageVersion=9.7.28170</p>
  </blockquote>
  
  <p>I get the error:
  <em>Value cannot be null or an empty string.</em> </p>
  
  <p>Interestingly, if I change the variable to be the description:</p>
  
  <pre><code>&lt;version&gt;1.1.0&lt;/version&gt;
  &lt;description&gt;$PackageVersion$&lt;/description&gt;
  </code></pre>
  
  <p>I get the error: <em>Description is required.</em></p>
  
  <p>When the tag is description the tag name is in the error message.  However, when the tag is version there is no tag name in the error message - only the term value.  Both are required fields.</p>
  
  <p>I am doing this with the command line on my local machine, but the TFS build gives the same error.  Here is the TFS tooltip for the Additional build properties for that step.
  <em>Specifies a list of token = value pairs, separated by semicolons, where each occurrence of $token$ in the .nuspec file will be replaced with the given value. Values can be strings in quotation marks.</em></p>
  
  <p>It sounds like I am following those rules.  And here is what TFS generates:</p>
  
  <blockquote>
    <p>"C:\Program Files\dotnet\dotnet.exe" pack
    D:\Agent_work\5\s\MyProject\MyProject.csproj --output
    D:\Agent_work\5\a /p:NuspecFile=App.nuspec
    /p:PackageVersion=9.7.28170 --verbosity Normal</p>
  </blockquote>
  
  <p>Same as my command.</p>
  
  <p>What am I doing wrong?</p>