How to restore nuget packages referenced by PCL (with project.json) on TFS 2013 Build Server
<h2>What I Need</h2>

<p>I'm trying to build PCL library (with project.json) on TFS 2013 Build Server with VS2015 Update1 installed.</p>

<h2>What's the problem</h2>

<p>Nuget packages (Mirosoft.NETCore and Microsoft.NETCore.Portable.Compatibility) for the PCL library are not restored.</p>

<p>I'm getting errors like</p>

<pre><code> Properties\AssemblyInfo.cs (9): The type or namespace name 'AssemblyTitle' could not be found (are you missing a using directive or an assembly reference?)
 Properties\AssemblyInfo.cs (17): Predefined type 'System.String' is not defined or imported
 Properties\AssemblyInfo.cs (29): Predefined type 'System.String' is not defined or imported
 Properties\AssemblyInfo.cs (30): Predefined type 'System.String' is not defined or imported

 C:\Users\MHABLDSvc\AppData\Local\Temp\.NETPortable,Version=v5.0.AssemblyAttributes.cs (4): Predefined type 'System.String' is not defined or imported
 C:\Users\MHABLDSvc\AppData\Local\Temp\.NETPortable,Version=v5.0.AssemblyAttributes.cs (4): The type or namespace name 'FrameworkDisplayName' could not be found (are you missing a using directive or an assembly reference?)
 C:\Users\MHABLDSvc\AppData\Local\Temp\.NETPortable,Version=v5.0.AssemblyAttributes.cs (4): Predefined type 'System.String' is not defined or imported
</code></pre>

<h2>What I've tried:</h2>

<p>The first attempt was to enable Automatic Package Restore in $slnDir$.nuget\nuget.exe. This works in visual studio, but not during the TFS Build.</p>

<p>So I changed the TFS build definition to build my <strong>build.proj</strong> instead of .sln file.</p>

<p>It restores nuget packages for .NET 4.6 class library, but not for my PCL library</p>

<p>build.proj</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0"
         DefaultTargets="Build"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;

  &lt;Target Name="UnsetReadonly"&gt;
    &lt;Exec Command="attrib -r &amp;quot;$(SourceDir)*.*&amp;quot; /s"/&gt;
  &lt;/Target&gt;

  &lt;Target Name="RestorePackages" DependsOnTargets="UnsetReadonly"&gt;
    &lt;Exec Command="&amp;quot;$(MSBuildThisFileDirectory)Nuget-Publishing\NuGet.exe&amp;quot; restore &amp;quot;%(Solution.Identity)&amp;quot;" /&gt;
  &lt;/Target&gt;

  &lt;Target Name="Clean"&gt;
    &lt;MSBuild Targets="Clean" 
             Projects="@(Solution)" /&gt;
  &lt;/Target&gt;



  &lt;Target Name="Build" DependsOnTargets="RestorePackages"&gt;

    &lt;MSBuild Targets="Build" 
             Projects="@(Solution)"
             UseResultsCache="True" StopOnFirstFailure="true" Properties="Verbosity=Minimal"  /&gt;

  &lt;/Target&gt;    
&lt;/Project&gt;
</code></pre>

<p><code>nuget.exe restore</code> says: All packages listed in packages.config are already installed. However, my problem are packaged from project.json</p>