I'm running into an issue with some NuGet packages not being restored during the msbuild process in a TFS build definition.
I have a total of nine NuGet packages in my solution and I can see seven of nine getting restored from the packages folder, however the other two never get restored or even attempted to be restored. The packages are listed in the packages.config and the corresponding folders exist in the build directory.
I've tried adding the additional NuGet Restore mentioned in this MS document and I've tried running the NuGet command manually without success.
Additional Details:
Contents of packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AWSSDK.Core" version="3.3.15" targetFramework="net40" requireReinstallation="true" />
<package id="AWSSDK.DynamoDBv2" version="3.3.4.14" targetFramework="net40" requireReinstallation="true" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40" requireReinstallation="true" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
<package id="RestSharp" version="105.2.3" targetFramework="net40" requireReinstallation="true" />
<package id="StackExchange.Redis" version="1.1.603" targetFramework="net40" requireReinstallation="true" />
<package id="Twilio" version="4.7.2" targetFramework="net40" />
<package id="Twilio.Lookups" version="1.1.0" targetFramework="net40" />
</packages>
From the TFS Output:
> Build started 6/29/2017 11:51:47 PM.
> 1>Project "B:\site_agent\_work\4d978bf9\Site\Site.sln" on node 1 (default targets).
> 1>ValidateSolutionConfiguration:
> Building solution configuration "Debug|Any CPU". B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 1>Project "B:\site_agent\_work\4d978bf9\Site\Site.sln" (1) is building "B:\site_agent\_work\4d978bf9\Site\site.metaproj" (2) on node
> 1 (default targets).
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
> currently targeted framework. ".NETFramework,Version=v4.5". To resolve
> this problem, either remove the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> or retarget your application to a framework version which contains
> "System.Runtime, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> B:\site_agent\_work\4d978bf9\Site\site.metaproj(0,0): Warning MSB3268:
> The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> 2>B:\site_agent\_work\4d978bf9\Site\site.metaproj : warning MSB3268: The primary reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> could not be resolved because it has an indirect dependency on the
> framework assembly "System.Threading.Tasks, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be
> resolved in the currently targeted framework.
> ".NETFramework,Version=v4.5". To resolve this problem, either remove
> the reference
> "B:\site_agent\_work\4d978bf9\Site\packages\StackExchange.Redis.1.1.603\lib\net40\StackExchange.Redis.dll"
> or retarget your application to a framework version which contains
> "System.Threading.Tasks, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\site\Bin\AjaxControlToolkit.dll" to
> "site\\Bin\AjaxControlToolkit.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll"
> to "site\\Bin\Microsoft.Threading.Tasks.Extensions.Desktop.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.xml"
> to "site\\Bin\Microsoft.Threading.Tasks.Extensions.Desktop.xml".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.dll"
> to "site\\Bin\System.IO.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.xml"
> to "site\\Bin\System.IO.xml".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll"
> to "site\\Bin\System.Threading.Tasks.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.xml"
> to "site\\Bin\System.Threading.Tasks.xml".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Twilio.4.7.2\lib\3.5\Twilio.Api.dll"
> to "site\\Bin\Twilio.Api.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Twilio.4.7.2\lib\3.5\Twilio.Api.pdb"
> to "site\\Bin\Twilio.Api.pdb".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Twilio.4.7.2\lib\3.5\Twilio.Api.xml"
> to "site\\Bin\Twilio.Api.xml".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Twilio.Lookups.1.1.0\lib\3.5\Twilio.Lookups.dll"
> to "site\\Bin\Twilio.Lookups.dll".
> Copying file from "B:\site_agent\_work\4d978bf9\Site\packages\Twilio.Lookups.1.1.0\lib\3.5\Twilio.Lookups.pdb"
> to "site\\Bin\Twilio.Lookups.pdb".
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v
> /localhost_55535 -p site\ -u -f
It appears that without a project file in the solution it doesn't automatically restore the dlls from the packages directory unless you add the .refresh file to the bin folder. Once I did that all of the package dlls were getting copied out of their respective folders in the packages directory for the solution to the bin folder before msbuild was called to start the compile.
Summary of solution: