之前我们使用过TFS 2013,并且有许多正确构建且没有问题的解决方案,通常每个Visual Studio项目使用至少一个NuGet包。
Previously we used TFS 2013 and had numerous solutions that built correctly and without problem on it, generally using at least one NuGet package per Visual Studio project.
在一个团队中基础项目我们有许多共享项目,这些项目被更多的控制台应用程序项目引用。 文件系统看起来如此:
In one Team Foundation project we have numerous shared projects that are referenced by even more numerous console application projects. The filesystem looks thusly:
我一直在创建构建定义来构建这些,我遇到了问题。 我确信我做错了,但在关注MSDN文章时,我从未得到文章中描述的结果。 为了论证,可以说所有项目(Common和Task项目)都引用了NuGetPackage Log4Net。 当我在我的开发机器上构建Visual Studio时,它构建没有问题。 当我在TFS上构建时,我遇到构建错误,说"找不到类型或命名空间名称'log4net'等等等等。"
I Have been creating build definitions to build these, and I have run into nothing but problems. I am certain that I am doing something wrong, but in following MSDN articles, I NEVER get results as described in the article. For the sake of argument, lets say that all projects (both Common and Task projects) reference the NuGetPackage Log4Net. When I build in Visual Studio on my dev machine, it builds without problem. When I build on TFS, I get build errors, saying that "The type or namespace name 'log4net' cannot be found... etc etc".
在构建机器上,我可以导航到构建代理工作文件夹并查看文件。 现在有两个包目录,一个位于common projects文件夹中,另一个位于任务项目文件夹中:
On the build machine I can navigate to the build agents working folders and view the files. There are now two packages directories, one in the common projects folder, and one in the task project folder:
这些常见项目最初是在Visual Studio 2015中创建的,用于在TFS 2013构建服务器上构建。 他们以前没有使用过PackageReference,但我已经删除并重新添加它们在Visual Studio中为每个项目选择包为PackageReferences。
These common projects were originally created in Visual Studio 2015 for build on a TFS 2013 build server. They did not use the PackageReference previously, but I have since removed and re-added them in Visual Studio selecting packages for each project to be PackageReferences.
我想我的问题是,构建引擎如何查找PackageReferenced依赖项? 为什么在构建计算机上找不到我的依赖项?
I guess my question is, how does the build engine look for PackageReferenced dependencies? Why are my dependencies not being found on the build machine?
目前,我的构建定义设置如下:
Currently, my build definition settings are the following:
NuGet恢复任务
解决方案的路径:指向解决方案文件
Path to Solution : Points to solution file
安装类型:恢复
Installation Type: Restore
高级=> NuGet版本:自定义
Advanced => NuGet Version: Custom
高级=> NuGet.exe的路径:指向NuGet 4.0可执行文件
Advanced => Path to NuGet.exe: Points to NuGet 4.0 executable
已启用:正确
Enabled: True
自动运行:正确
Autorun: True
构建解决方案任务:
解决方案指向解决方案文件(解决方案包括共享(通用)项目和任务项目,如上所示)
Solution points to the solution file (solution includes shared (common) projects and the task projects as shown above)
平台:x64
Platform: x64
配置:调试
Configuration: Debug
Visual Studio版本:Visual Studio 2017
Visual Studio Version: Visual Studio 2017
MSBuild架构:MSBuild x64
MSBuild Architecture: MSBuild x64
记录项目详细信息:正确
Record Project Details: True
推荐答案
您好Cory CodeWarrior,
Hi Cory the CodeWarrior,
请尝试在构建计算机上使用visual studio构建项目。您能否成功构建它?
Please try to build your project using visual studioon your build machine.Could you build it successfully?
如果没有,请检查您的引用是否已成功添加到解决方案中。
If not, please check whether your references are added to the solution successfully.
最好的问候
更多推荐
从TFS 2013更新到TFS 2017.NuGet包引用导致构建错误
发布评论