Running into an issue were project compiles locally just fine, but TFS build is reporting that assemblies cannot be found.
Log file will show:
2>C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1696,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "HtmlAgilityPack". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Builds\1\MyProj\MyProj-Dev-Site\src\MyProj\MyProj.Domain\MyProj.Domain.csproj] For SearchPath "{HintPathFromItem}". Considered "..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll", but it didn't exist.
The issue I have is that there is most certainly a /packages/ folder in the location:
C:\Builds\1\MyProj\MyProj-Dev-Site\src\MyProj\packages\
Is the relative hint path somehow different on the TFS server? Seems like it would be relative to the .csproj file it was inspecting. I can confirm on the build output folder that the package (and DLL) are exactly where the HintPath specifies it should be.
Update: I found the solution to my issue. It's two-fold. One is that I cannot read file explorer and failed to notice that my HtmlAgilityPack folder only had the package's XML file, not the actual DLL. Second, I had to remove the 'packages' folder from TFS by going to 'Source Control Explorer' and removing that from my project. TFS handled the rest. Everything builds properly now.
More info: http://robertgreiner.com/2013/09/team-foundation-service-build-error-nuget/