在 TFS 构建期间未找到程序集 [英] Assembly not found during TFS Build

查看:52
本文介绍了在 TFS 构建期间未找到程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本地编译项目时遇到问题,但 TFS 构建报告找不到程序集.

Running into an issue were project compiles locally just fine, but TFS build is reporting that assemblies cannot be found.

日志文件将显示:

2>C:\Program Files(x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1696,5):警告 MSB3245:无法解析此引用.找不到程序集HtmlAgilityPack".检查以确保程序集存在磁盘上.如果您的代码需要此引用,您可能会得到编译错误.[C:\Builds\1\MyProj\MyProj-Dev-Site\src\MyProj\MyProj.Domain\MyProj.Domain.csproj]对于搜索路径{HintPathFromItem}".考虑..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll",但是它不存在.

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.

我遇到的问题是该位置肯定有一个/packages/文件夹:

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\

C:\Builds\1\MyProj\MyProj-Dev-Site\src\MyProj\packages\

TFS 服务器上的相对提示路径有什么不同吗?似乎它与它正在检查的 .csproj 文件有关.我可以在构建输出文件夹上确认包(和 DLL)正是 HintPath 指定的位置.

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.

更新:我找到了问题的解决方案.这是双重的.一是我无法读取文件资源管理器并且没有注意到我的 HtmlAgilityPack 文件夹只有包的 XML 文件,而不是实际的 DLL.其次,我必须通过转到源代码管理资源管理器"并将其从我的项目中删除来从 TFS 中删除包"文件夹.TFS 处理剩下的.现在一切正常.

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.

更多信息:http://robertgreiner.com/2013/09/team-foundation-service-build-error-nuget/

推荐答案

因为这里没有官方答案(即使 OP 把它放在上面):

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

更新:我找到了问题的解决方案.这是双重的.一是我无法读取文件资源管理器并且没有注意到我的 HtmlAgilityPack 文件夹只有包的 XML 文件,而不是实际的 DLL.其次,我必须通过转到源代码管理资源管理器"并将其从我的项目中删除来从 TFS 中删除包"文件夹.TFS 处理剩下的.现在一切正常.

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.

似乎与从 TFS 运行构建的方式有关,如果packages"文件夹已经存在,即使在一个非常好的位置,即使在本地工作的预期相对位置,MSBuild 也不会接受该位置并且更喜欢递归搜索所有 .targets 目录.无论如何,我可以确认删除 ..\packages 文件夹在 VS2015/TFS2013 中有效.

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.

这篇关于在 TFS 构建期间未找到程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆