问题描述
我在本地服务器和Visual Studio 2015上使用TFS 2015.我有一个引用来自2个不同存储库的项目的解决方案。
I'm using TFS 2015 on a local server and Visual Studio 2015. I have a solution that references projects from 2 different repositories.
在本地开发人员计算机上,我有使用相对路径的解决方案和项目文件引用:
On the local developer machines, I have the solution and project files references using relative paths:
TFS
----Repo1
--------Project1
--------Project2
--------Project3
--------Solution1
----Repo2
--------Project4
--------Project5
--------Project6
--------Solution2
Solution1使用.. \..\ Repo2 \ Project4引用Project4。这在VS 2015本地构建解决方案时工作正常
Solution1 references Project4 by using ..\..\Repo2\Project4. This works fine when building the solution locally on VS 2015
现在我正在尝试在TFS 2015中自动构建。由于Solution1的构建定义在Repo1内部,因此无法引用任何内容Repo2。所以我将Repo2映射为Repo1中的文件夹,并单独构建了所有项目。这项工作,所有项目
从Project1到Project6单独构建,除了最后一个项目,它引用了Project4,Project5和Project6。我收到以下错误消息:
Now I'm trying to automate the build in TFS 2015. Since the build definition for Solution1 is inside Repo1, it cannot reference anything in Repo2. So I mapped Repo2 as a folder in Repo1, and built all the projects individually. This worked, all the projects from Project1 to Project6 build individually, except for the last project, which is referencing Project4, Project5 and Project6. I get the following error message:
错误CS0246:找不到类型或命名空间名称"Project4"(您是否缺少using指令或程序集引用?)
Error CS0246: The type or namespace name 'Project4' could not be found (are you missing a using directive or an assembly reference?)
我尝试使用/ p:Reference,/ p:ReferencePath,/ p:AdditionalLibPaths以多种方式向MSBuild Arguments添加参数:这是一次尝试:
I have tried adding parameters to MSBuild Arguments using /p:Reference, /p:ReferencePath, /p:AdditionalLibPaths in multiple ways: This is one attempt:
/p:ReferencePath="$(build.sourcesdirectory)\Repo2\Project4\bin\Debug $(build.sourcesdirectory)\ Repo2 \ Project5\bin\Debug $(build.sourcesdirectory)\\ \\ repo2 \ Project6 \ bin \Debug"
/p:ReferencePath="$(build.sourcesdirectory)\Repo2\Project4\bin\Debug $(build.sourcesdirectory)\Repo2\Project5\bin\Debug $(build.sourcesdirectory)\Repo2\Project6\bin\Debug"
但它似乎不起作用。
如何添加对缺少dll所以我的最后一个项目可以构建吗?
How do I add references to the missing dlls so my last project can be built?
谢谢
推荐答案
您可以将两个存储库的项目映射到您的构建定义,请保持文件夹结构与本地计算机相同:
You could map two repositories' items to your build definition, please keep the folder structure the same as your local machine:
最好的问候
这篇关于TFS 2015构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!