title: Using MSBuild, '$(SolutionDir)' resolves incorrectly to C:\ when running 'msbuild /t:restore'
body: <p>I have <strong>foo.csproj</strong>,</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
  
    &lt;PropertyGroup Label="Globals"&gt;
              &lt;ExtPath&gt;$(SolutionDir)\WpfNetStandardSample\CustomProjectSystem\&lt;/ExtPath&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;Import Project="$(ExtPath)CustomProject.props" /&gt;
  
  &lt;/Project&gt;
  </code></pre>
  
  <p>referenced from solution file <strong>bar.sln</strong>.</p>
  
  <p>To restore my NuGet packages from the continuous integration server, I run</p>
  
  <pre><code>msbuild /t:restore bar.sln
  </code></pre>
  
  <p>And I get the error:</p>
  
  <blockquote>
    <p>"C:\Users\phelan\workspace\bar\bar.sln" (restore target) (1) ->
    "C:\Users\phelan\workspace\bar\foo\foo.csproj"
    (_IsProjectRestoreSupported target) (11) ->
    C:\Users\phelan\workspace\bar\foo\foo.csproj(7,3): error
    MSB4019: The imported project
    "C:\WpfNetStandardSample\CustomProjectSystem\CustomProject.props" was
    not found. Confirm that the path in the  declaration is
    correct, and that the file exists on disk.</p>
  </blockquote>
  
  <h1>Main Question</h1>
  
  <p>How and why is <strong>SolutionDir</strong> resolving to <strong>C:\</strong> and not the directory the solution file is in?</p>
  
  <h1>Notes</h1>
  
  <ul>
  <li>The entire solution builds from within Visual Studio.</li>
  <li>Running <code>msbuild foo.sln</code> builds the entire solution (assuming NuGet packages are already restored)</li>
  <li>MSBuild version is 15.3.409.57025</li>
  <li>The solution is a mixture of projects, some using packages.config and some using PackageReference. Some of the projects using PackageReference are dotnetstandard libraries and some are net461 libraries.</li>
  <li>There seems to be a variety of suggestion on how to restore NuGet packages
  
  <ul>
  <li><code>dotnet restore</code></li>
  <li><code>nuget restore</code> <a href="https://i.stack.imgur.com/iHgpU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iHgpU.png" alt="Enter image description here"></a></li>
  <li><code>msbuild /t:restore</code></li>
  <li><code>dotnet msbuild /t:restore foo.sln</code></li>
  </ul></li>
  </ul>
  
  <p>What is the correct process for my type of mixed setup?</p>
  
  <h1>GitHub repository for reproducing the error</h1>
  
  <p><a href="https://github.com/bradphelan/msbuildbug" rel="nofollow noreferrer">https://github.com/bradphelan/msbuildbug</a></p>