title: One NuGet package (SQLite Core) is causing TFS builds to fail
body: <p>My solution is configured to "restore packages", but one of its projects is failing to build:-</p>
  
  <blockquote>
    <p>3>C:\Builds\1\xxxxx\xxxx.csproj(223,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see <a href="http://go.microsoft.com/fwlink/?LinkID=322105" rel="nofollow">http://go.microsoft.com/fwlink/?LinkID=322105</a>. The missing file is ..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\System.Data.SQLite.Core.targets.</p>
  </blockquote>
  
  <p>It might be a red-herring but the above error appears in the log <em>before</em> the package restore stuff, i.e.</p>
  
  <blockquote>
    <p>2>RestorePackages:</p>
    
    <p>Restoring NuGet packages...</p>
  </blockquote>
  
  <p>Near the end of the offending project's .csproj file is this <code>&lt;Target&gt;</code> section, that appears to be generating the above error:-</p>
  
  <pre><code>&lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&gt;
  &lt;Import Project="$(SolutionDir)\.nuget\nuget.targets" /&gt;
  &lt;Import Project="..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\System.Data.SQLite.Core.targets')" /&gt;
  
  &lt;Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"&gt;
    &lt;PropertyGroup&gt;
      &lt;ErrorText&gt;This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.&lt;/ErrorText&gt;
    &lt;/PropertyGroup&gt;
    &lt;Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.97.0\build\net45\System.Data.SQLite.Core.targets'))" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>What's going on? And am I correct in my assumption that this check is happening before the solution's packages have even been restored (hence why it's failing)? How do I fix this?</p>
  
  <p>Other projects in the solution (those that don't reference the SQLite core package) have their packages restored fine, and build successfully.</p>