title: MSBuild error finding the nuget.targets file
body: <p>I'm trying to build a csproj project with msbuild, but having all sorts of weird issues with it complaining about not finding nuget.targets.</p>
  
  <p>I run the simplest of command line builds with MSbuild:</p>
  
  <pre><code>Msbuild Project.csproj
  </code></pre>
  
  <p>And that works in my normal dev folder, but in another folder location, it fails with these errors:</p>
  
  <p><code>error MSB4019: The imported project "C:\BuildAgent\work\CableSense\.nuget\nuget.targets" was not found. Confirm that the path in the &lt;Import&gt; declaration is correct, and that the file exists on disk.</code></p>
  
  <p>That path (<code>C:\BuildAgent\work\CableSense\.nuget\nuget.targets</code>) is actually wrong and is missing a folder after work (work\somefolder\cablesense), but I'm at a loss why. More weirdly, if I build another project that is part of the solution, then that works, it's just this project.</p>
  
  <p>The csproj specifies the location of the nuget.targets file like this:</p>
  
  <pre><code>&lt;Import Project="$(SolutionDir)\.nuget\nuget.targets" /&gt;
  </code></pre>
  
  <p>And the SolutionDir is defined like so:</p>
  
  <pre><code>&lt;SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'"&gt;..\&lt;/SolutionDir&gt;
  </code></pre>
  
  <p>Which is the same as the other project that does work. Any ideas?</p>