简体   繁体   English

TFS Build 2013 - 无法解析主要参考

[英]TFS Build 2013 - Cannot resolve primary reference

I'm evaluating TFS Build 2013 for use in a corporate environment. 我正在评估TFS Build 2013以用于企业环境。 TFs itself has been running fine for ages, and today I setup the Build components. TF本身运行良好多年,今天我设置了Build组件。 No problem so far. 到目前为止没问题。

I grabbed a fairly simple project from source and created a manually triggered build definition, using the standard defaults. 我从源代码中获取了一个相当简单的项目,并使用标准默认值创建了一个手动触发的构建定义。

I ran a test build and hit an issue straight away with a primary reference. 我运行了一个测试版本并立即使用主要参考文章来解决问题。 The error in the logs is: 日志中的错误是:

C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\amd64\\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. C:\\ Program Files(x86)\\ MSBuild \\ 12.0 \\ bin \\ amd64 \\ Microsoft.Common.CurrentVersion.targets(1697,5):警告MSB3245:无法解析此引用。 Could not locate the assembly "XYZ.dll". 找不到程序集“XYZ.dll”。

So a bit of back of background on how we store and use references: We create a root folder for the solution, inside this goes the .sln file and sub directories for the projects as normal. 关于我们如何存储和使用引用的背景知识背后:我们为解决方案创建了一个根文件夹,其中包括正常的项目的.sln文件和子目录。 We then add a "References" folder at this level, which holds all of the DLLs required for the project. 然后,我们在此级别添加一个“References”文件夹,其中包含项目所需的所有DLL。 These are generally DLLs from other in house code libraries, but also certain 3rd party ones (such as the old Enterprise Library DLLs, and anything else we don't get from NuGet). 这些通常是来自其他内部代码库的DLL,但也包括某些第三方DLL(例如旧的Enterprise Library DLL,以及我们未从NuGet获得的任何其他内容)。

Each of the projects that require these DLLs reference this folder (and from inspecting the .proj files I can see the link is stored as "..\\References\\XYZ.dll" etc. This works fine for local builds and nobody has ever had an issue. The reference folder gets checked into TFS and everybody gets a copy. From what I've read through trying to diagnose our issue, this is a fairly common and accepted way to manage references. 每个需要这些DLL的项目都引用这个文件夹(从检查.proj文件,我可以看到链接存储为“.. \\ References \\ XYZ.dll”等。这适用于本地构建,没有人曾经有过一个问题。参考文件夹被检入TFS并且每个人都得到一个副本。从我读过的尝试诊断我们的问题,这是一种相当普遍和可接受的方式来管理引用。

So, the build error that I receive is as above. 因此,我收到的构建错误如上所述。 Basically saying the build target can't find the DLL from the References folder. 基本上说构建目标无法从References文件夹中找到DLL。 The log goes on to list all of the places it's tried to find it. 日志继续列出它试图找到它的所有地方。

Crucially (it would seem) the first line reads: 至关重要(似乎)第一行是:

For SearchPath "{HintPathFromItem}". 对于SearchPath“{HintPathFromItem}”。 Considered "..\\References\\XYZ.dll", but it didn't exist. 考虑“.. \\ References \\ XYZ.dll”,但它不存在。

Furthermore it looks in the Framework folder, various default assembly folders, the GAC and so on, none of which (of course) contains it. 此外,它查看Framework文件夹,各种默认程序集文件夹,GAC等,其中没有一个(当然)包含它。

So I'm wondering where I've gone wrong. 所以我想知道我哪里出错了。 Have I misconfigured one of the build/drop locations? 我是否错误配置了其中一个构建/放置位置? Is there some other convention for referencing required DLLs (bearing in mind our entire company uses the "..\\References" folder setup, or is there something else? 是否有一些其他约定用于引用所需的DLL(请记住我们整个公司使用“.. \\ References”文件夹设置,或者还有其他什么?

I'm fairly new to TFS Build, but I'm by no means new to TFS or Visual Studio itself. 我是TFS Build的新手,但我对TFS或Visual Studio本身并不陌生。 I've spent about an hour or so Googling without finding anyone experiencing the same issue as me, so any help would be greatly appreciated. 我花了大约一个小时左右的谷歌搜索没有发现任何人遇到与我相同的问题,所以任何帮助将不胜感激。

Thanks 谢谢

UPDATE: 更新:

The build agent is configured as follows: 构建代理配置如下:

Build Agent- working directory: 构建代理 - 工作目录:

D:\\BuildAgent\\$(BuildAgentId)\\$(BuildDefinitionPath) d:\\ BuildAgent \\ $(BuildAgentId)\\ $(BuildDefinitionPath)

The build definition "Source Settings" have the (I assume) default values of: 构建定义“源设置”具有(我假设)默认值:

Status: Active | 状态:有效| Source Control Folder: $/ProjectRoot | 源代码控制文件夹:$ / ProjectRoot | Build Agent Folder: $(SourceDir) 构建代理文件夹:$(SourceDir)

Status: Cloaked | 状态:隐形| Source Control Folder: $/ProjectRoot/Drops | 源代码控制文件夹:$ / ProjectRoot / Drops | Build Agent Folder: 构建代理文件夹:

The references folder is not explicitly configured here, but when I look in the Build Agent's working directory I can see it: 这里没有显式配置references文件夹,但是当我查看Build Agent的工作目录时,我可以看到它:

D:\\BuildAgent\\1\\ClientName\\SolutionName\\src\\Dev\\Evolution\\Source\\SolutionName.Solution\\References d:\\ BuildAgent \\ 1 \\ CLIENTNAME \\解决方案名称\\ SRC \\开发\\演进\\源\\ SolutionName.Solution \\参考

If I open VS2013 Command Prompt, navigate to the folder that contains the .sln file (and also the References folder) and run "msbuild d:\\path\\to\\Solution.sln" then it builds successfully with no warnings or errors. 如果我打开VS2013命令提示符,导航到包含.sln文件(以及References文件夹)的文件夹并运行“msbuild d:\\ path \\ to \\ Solution.sln”,然后它成功构建,没有任何警告或错误。

Well it turns out this wasn't a fault with TFS at all... 嗯,事实证明这根本不是TFS的错...

The problematic DLL, although present in the References folder, was not actually checked into TFS. 有问题的DLL虽然存在于References文件夹中,但实际上并没有检入TFS。

Right clicking the References folder in VS (added as a "Solution Folder") and selecting to Add Existing Item, then a check in fixed the issue. 右键单击VS中的References文件夹(添加为“解决方案文件夹”)并选择添加现有项目,然后检入以解决问题。

So the References folder was being used as you would expect, in the same way that VS uses it. 因此,正如您所期望的那样使用References文件夹,就像VS使用它一样。 MSBuild worked locally because I had the file in my local folder, but because it wasn't part of the solution it wasn't with the rest of the source. MSBuild在本地工作,因为我在我的本地文件夹中有文件,但因为它不是解决方案的一部分,所以不是源代码的其余部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM