title: Visual Studio 2017 extension - VSToolsPath not working
body: <p>I'm updating an old Visual Studio extension for VS 2017. It compiles fine from Visual Studio and msbuild in debug and release on my local computer. </p>
  
  <p>This is the msbuild command line I am using:</p>
  
  <pre><code>msbuild VxCop.sln /p:ToolsHome=C:\ProgramData\chocolatey\bin /p:Configuration=Release /p:Platform="Any CPU"  
  </code></pre>
  
  <p>However, on the build machine (TFS Build 2010) calling msbuild.exe with the same command line it fails with <a href="https://developercommunity.visualstudio.com/content/problem/38482/error-msb4226-the-imported-project-vssdkmicrosoftv.html" rel="nofollow noreferrer">this error</a></p>
  
  <p>In order to fix this I am trying to specify VSToolsPath. I've tried various things such as altering the VSToolsPath entry in the .csproj (which seems to not be taken into account since doing this had no effect) and also passing it on the command line:</p>
  
  <pre><code>msbuild VxCop.sln /p:ToolsHome=C:\ProgramData\chocolatey\bin /p:Configuration=Release /p:Platform="Any CPU"  /p:VSToolsPath=Packages\Microsoft.VSSDK.BuildTools.15.1.192\tools\
  </code></pre>
  
  <p>This causes a very strange error:</p>
  
  <pre><code>CopyFilesToOutputDirectory:                                                                                          
    Copying file from "obj\Release\SymCop.dll" to "bin\Release\SymCop.dll".                                            
    SymCop -&gt; H:\src\tools\VisualStudioExtensions\Main\VxCop\source\SymCop\bin\Release\SymCop.dll                      
    Copying file from "obj\Release\SymCop.pdb" to "bin\Release\SymCop.pdb".                                            
  Done Building Project "H:\src\tools\VisualStudioExtensions\Main\VxCop\source\SymCop\SymCop.csproj" (default targets).
  
  Done Building Project "H:\src\tools\VisualStudioExtensions\Main\VxCop\VxCop.sln" (Build target(s)) -- FAILED.        
  
  Done Building Project "H:\src\tools\VisualStudioExtensions\Main\VxCop\build.proj" (default targets) -- FAILED.       
  
  
  Build FAILED.                                                         
      0 Warning(s)                                                      
      0 Error(s)                                                        
  </code></pre>
  
  <p>The actual extension project isn't appearing in the log at all, and there's no, y'know, errors. But the build returns as failed, the return code is non-zero, and the vsix project seems to not be built (its output is missing)</p>
  
  <p>Hopefully someone has some suggestions</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>For those reading this in the future, the problem seemed to be that there was an <code>&lt;Import&gt;</code> further down in the same file which didn't care about my update to <code>$(VSToolsPath)</code>. </p>
  
  <p>Changing that import fixed it:</p>
  
  <pre><code> &lt;Import Project="$(SolutionDir)\packages\Microsoft.VSSDK.BuildTools.15.1.192\tools\VSSDK\Microsoft.VsSDK.targets" 
   /&gt;
  </code></pre>