Wiki
This website is a wiki. If you like and use our processes, techniques and tools, please add your experience and best practices. Just register and share.


Contents


User


Smart


Community

















Team Build

The VSTS Team Build is a build tool which uses a Nant-like XML script, containing tasks.

Team Build Type

To be able to run a build you need a build type. More information on how to create a new build type you can find on the MSDN site: http://msdn2.microsoft.com/en-us/library/ms181715(VS.80).aspx

Building of solutions in different team projects

Default you are able to build only solutions in the team project you are creating the build type for. What you get creating a new type using the wizard is the following:

<ItemGroup>
<SolutionToBuild Include="$(SolutionRoot)\Sources\<solution>.sln" />
</ItemGroup>

$(SolutionRoot) contains the local path of the team project in the workspace. To be able to build over team projects we have to re-map $(SolutionRoot) to a higher lever, to the source control root.

<ItemGroup>
<!-- add one entry for every Team Project we reference -->
<Map Include="$/ADF">
<LocalPath>$(SolutionRoot)\ADF</LocalPath>
</Map>
<Map Include="$/<team project>">
<LocalPath>$(SolutionRoot)\<team project></LocalPath>
</Map>
</ItemGroup>

<Target Name="BeforeGet">
<DeleteWorkspaceTask
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>

Register these properties in the <PropertyGroup> tag:
<TfCommand>$(TeamBuildRefPath)\..\tf.exe</TfCommand>
<SkipInitializeWorkspace>true</SkipInitializeWorkspace>

Building a Setup and Deployment project

A setup and deployment project creates an MSI for your application. But the team build is not able to build this project type for you. An alternative is to use WiX, which is built by the team build.
There is a way to build the setup project on the build server, by calling the VS IDE with the /Build parameter:
<Target Name="AfterCompile">
<Exec Command=""$(DevenvCommand)" $(SolutionRoot)\Sources\<solution>.sln /Build "CreateSetup|Any CPU" /Out $(OutDir)\$(BuildNumber).log"/>
<Copy SourceFiles="$(SolutionRoot)\Sources\<setup project>\Release\<filename>.msi" DestinationFolder="$(OutDir)" />
</Target>

Make sure your solution has a build configuration which includes only the setup project (in the example: "CreateSetup|Any CPU").

Note: Visual Studio needs to be installed on the build server