title: How to sync version numbers for nuget packages when targeting multiple project files
body: <p>I have a project which has three project files targeting various .net versions (<code>mylib.net20.csproj</code>, <code>mylib.net40.csproj</code>, and <code>mylib.net40-client.csproj</code>). I have a single nuspec file named <code>mylib.nuspec</code> for packaging them all together.</p>
  
  <p>It might help to see the files section of the nuspec file, so here it is: </p>
  
  <pre><code>&lt;files&gt;
      &lt;file src="bin\net20\*.dll" target="lib\net20\" /&gt;
      &lt;file src="bin\net40-client\*.dll" target="lib\net40-client\" /&gt;
      &lt;file src="bin\net40\*.dll" target="lib\net40\" /&gt;
  &lt;/files&gt;
  </code></pre>
  
  <p>Right now I use a static version number in the nuspec file and I can successfully package everything by running <code>nuget pack mylib.nuspec</code>. However, I would like to start using <code>$version$</code> so I don't have to remember to update the version number in two places. </p>
  
  <p>If I simply change the version number to <code>$version$</code>, and build in the same way I get the predictable error: </p>
  
  <pre><code>Attempting to build package from 'mylib.nuspec'.
  The replacement token 'version' has no value.
  </code></pre>
  
  <p>If I use <code>$version$</code> and package with <code>nuget pack mylib.net40.csproj</code>, it is successful, but I get a package that completely ignores the nuspec file. </p>
  
  <p><strong>Q:</strong> What can I do to get the <code>$version$</code> variable to work?</p>
  
  <p>Technically, I could rename my nuspec file to <code>mylib.net20.nuspec</code> and then package with <code>nuget pack mylib.net20.nuspec</code>. I really don't want to rename my nuspec file in this way though.</p>