Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly not found during TFS Build

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/

like image 232
Kyle B. Avatar asked Oct 31 '22 05:10

Kyle B.


1 Answers

Since there's no official answer here (even though the OP put it above):

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.

It seems that something about the way the build is run from TFS, if the "packages" folder already exists, even in a perfectly good location, even in the expected relative location that works locally, MSBuild just will not accept that location and prefers to recursively search all of the .targets directories instead. Anyway I can confirm that deleting the ..\packages folder works in VS2015/TFS2013.

like image 153
Chaim Eliyah Avatar answered Nov 08 '22 14:11

Chaim Eliyah