使用tfs进行团队开发 - 第二部分

Page 53

z

夹?”,地址为:http://blogs.msdn.com/manishagarwal/archive/2005/10/13/480584.aspx 有关 WorkspaceMapping 体系结构的详细信息,请参见“WorkspaceMapping.xml 文件的体系结 构”,地址为: http://blogs.msdn.com/buckh/archive/2007/02/28/schema-for-the-workspacemapping-xml-file.aspx

如何生成在其他团队项目中具有依赖项的项目 Team Build 不支持跨团队项目的生成解决方案。要支持该功能,必须自定义 TFSBuild.proj 文件以 从生成所依赖的其他项目中签出所需的代码。 要生成一个对其他团队项目有依赖项的项目,您需要将该项目中的源或程序集放置到生成服务器的 工作区中。要执行该操作,需要编辑 TFSBuild.proj 文件以添加程序集或解决方案引用,并重写 BeforeGet 事件以从具有依赖项的每个团队项目中获得程序集或源。 要生成在其他团队项目上具有依赖项的项目 1. 2.

从“源代码管理资源管理器”签出 TFSBuild.proj 脚本。 在 PropertyGroup 部分下添加以下配置设置: <!-- to be added under PropertyGroup --> <TfCommand>$(TeamBuildRefPath)\..\tf.exe</TfCommand> <SkipInitializeWorkspace>true</SkipInitializeWorkspace> SkipInitializeWorkSpace 允许您跳过对在生成机器上删除和重新创建工作区的默认任务的调用。 新属性用在自定义的目标 BeforeGet 中(见下文)。

3.

将以下配置设置添加到映射团队项目和解决方案的 ItemGroup 项中。确保为生成机器提供了正 确的本地路径。多个映射无法共享相同的本地文件夹,将会在 CreateWorkspace 任务中导致 MappingConflictException 异常。 <ItemGroup> <!-- add one entry for every solution you reference --> <SolutionToBuild Include="$(SolutionRoot)\DependentApp\DependentApp.sln" /> <SolutionToBuild Include="$(SolutionRoot)\YourApp\YourApp.sln" /> </ItemGroup> <ItemGroup> <!-- add one entry for every Team Project you reference --> <Map Include="$/YourApp/YourApp"> <LocalPath>$(SolutionRoot)\YourApp</LocalPath> </Map> <Map Include="$/DependentApp/DependentApp"> <LocalPath>$(SolutionRoot)\DependentApp</LocalPath> </Map> </ItemGroup>

4.

重写 BeforeGet 事件,检索各团队项目的工作区。 <Target Name="BeforeGet"> <DeleteWorkspaceTask TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Name="$(WorkspaceName)" /> <Exec WorkingDirectory="$(SolutionRoot)" Command=""$(TfCommand)" workspace /new $(WorkSpaceName) /server:$(TeamFoundationServerUrl)"/> <Exec WorkingDirectory="$(SolutionRoot)"


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.