Team Build with multiple team projects
I have got the following structure:
$
--TeamProject1
---Solution1.sln
----TestProject1
--TeamProject2
---Solution2.sln
----TestProject2
In TestProject1, I add TestProject2.dll as reference (Not a project reference, but a file reference). My question is: how to build a solution that reference to assemblies belonging to different team project?
I have got TFSBuild.proj file containing the following info:
<TfCommand>$(TeamBuildRefPath)\..\tf.exe</TfCommand>
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../DEV/TeamProject1.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
<Map Include="$/TeamProject1">
<LocalPath>$(SolutionRoot)</LocalPath>
</Map>
<Map Include="$/TeamProject2">
<LocalPath>$(SolutionRoot)</LocalPath>
</Map>
<Target Name="BeforeGet">
<Del开发者_开发问答eteWorkspaceTask TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Name="$(WorkspaceName)" />
<Exec WorkingDirectory="$(SolutionRoot)" Command=""$(TfCommand)" workspace /new $(WorkspaceName) /server:$(TeamFoundationServerUrl)" />
<Exec WorkingDirectory="$(SolutionRoot)" Command=""$(TfCommand)" workfold /unmap /workspace:$(WorkSpaceName) "$(SolutionRoot)"" />
<Exec WorkingDirectory="$(SolutionRoot)" Command=""$(TfCommand)" workfold /map /workspace:$(WorkSpaceName) /server:$(TeamFoundationServerUrl) "%(Map.Identity)" "%(Map.LocalPath)"" />
</Target>
Thanks in advance.
Xiaosu
To quote the official TFS guide on CodePlex:
If you share source or binaries across team projects, you have two options:
Branching. With this approach, you branch the source from the other team project into your current solution. This creates a configuration that unifies the source from the shared location and your project on the server-side.
Workspace Mapping. With this approach, you map the source from the other team project into a workspace on your development computer. This creates a configuration that unifies the source from the other team project and your project on the client-side.
Branching is the preferred approach because it stores the dependency relationship on the source control server. Workspace mapping is a client-side-only approach, which means that you and every developer must create the mapping on your own computers and also on the build server in order to successfully build the application.
Branching adds additional merge overhead but it enables you to make the decision to pick up updated binaries or source more explicitly.
AFAIK this is not possible and it will be problematic on developer's machines. File references is the way to go. I usually organize projects like this:
$
-- TeamProject1
-- branches
-- trunk
Solution1.sln
-- lib
TestProject2.dll
-- src
-- test
TestProject1.csproj references TestProject2.dll from lib
-- TeamProject2
-- branches
-- trunk
Solution2.sln
-- lib
-- src
-- test
TestProject2.csproj
This way TeamProject1 is independent from the source code of TeamProject2 and it contains all the necessary dependencies. If TeamProject2 changes it won't necessary break TeamProject1.
It was very difficult to find the actual answer for this and it wasted a lot of my time. So if you ever get this problem, here is a link to the correct solution
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9918911f-5951-43be-9ee9-00214cf17400/buildvnext-and-multiple-team-projects?forum=tfsbuild
Basically the UI does not allow you to select more than one team project on your collection. But you can always type the actual path to your other team projects and it will work
精彩评论