This articles explains how you can use the Jazz Ant Tasks in the IBM Rational Team Concert (RTC) build for Microsoft Visual Studio (VS) projects or solutions. For integration support details please visit System Requirements
<?xml version="1.0" encoding="utf-8" ?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <AntCommand>C:\BuildToolKit\jazz\buildsystem\buildengine\eclipse\plugins\org.apache.ant_1.7.1.v20100518-1145\bin\ant -lib C:\BuildToolKit\jazz\buildsystem\buildtoolkit</AntCommand> <propertyFile>-propertyfile C:\BuildToolKit\jazz\buildsystem\buildengine\eclipse\build.properties</propertyFile> <jazzbuildxml>-f $(fetchDestination)\TBDForm\TBDForm\build.xml</jazzbuildxml> </PropertyGroup> </Project>
Above
AntCommand uses the ant executable packaged with the Jazz Build Tool Kit.
propertyFile can be created in any location. This file is automatically created when the Build is triggered. You can chose any location where you want this file to be created.
jazzbuildxml is the file in which you will define the Ant Targets to build. See below.
Please note the paths mentioned above and in rest of article depends on where you save the files in your Visual Studio Solution or where they are located. In this article paths are used from the system where the setup was created. So replace the paths according to your setup.
<?xml version="1.0" encoding="utf-8" ?> <project name="jazz build targets" default="startActivity"> <property name="userId" value="jazzadmin"/> <property name="password" value="jazzadmin"/> <import file="C:\BuildToolKit\jazz\buildsystem\buildtoolkit\BuildToolkitTaskDefs.xml"/> <target name="startActivity"> <startBuildActivity repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" activityIdProperty="buildactivityId" label="${activityLabel}" autoComplete="true" verbose="true" buildResultUUID="${buildResultUUID}" /> </target> <target name="publishActivity"> <tstamp/> <startBuildActivity buildResultUUID="${buildResultUUID}" label="${activityLabel}" autoComplete="true" repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}"/> <artifactFilePublisher repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" buildResultUUID="${buildResultUUID}" filePath="${team.scm.fetchDestination}\TBDForm\TBDForm\bin\RTCBuildDebug\TBDForm.exe" label="TBDForm Debug Executable"/> <artifactFilePublisher repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" buildResultUUID="${buildResultUUID}" filePath="${team.scm.fetchDestination}\TBDForm\TBDForm\bin\RTCBuildDebug\TBDForm.pdb" label="TBDForm pdb symbols"/> <linkPublisher repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" buildResultUUID="${buildResultUUID}" url="http://www.ibm.com" label="www.ibm.com" /> </target> </project>
Find the following line the .csproj file
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Add the following line after it:
<Import Project="..\TBDForm\CommonProperties.xml" />" />
Location of the MSbuild property file depends upon where you have created it in the VS Project Directory.
There are two ways to achieve this.
Note: Do not make a copy of the other Build configuration. Create a new one from scratch. eg RTCBuildDebug.
Add Pre-Build and Post-Build Event to the MSBuild
if $(Configuration) == RTCBuildDebug ($(AntCommand) -DactivityLabel=Starting_$(AssemblyName) $(propertyFile) $(jazzbuildxml) startActivity)
if $(Configuration) == RTCBuildDebug ($(AntCommand) -DactivityLabel=Finished_$(AssemblyName) $(propertyFile) $(jazzbuildxml) publishActivity)
In essence the MS Build Pre/Post-Build event commands call Ant on the startActivity or publishActivity targets in the build.xml file. The if $(Configuration) == RTCBuildDebug condition ensures that those tasks are only executed if we invoke the build using the Jazz Build Definition which is using RTCBuildDebug build configuration to build the project. Thus allowing the user to run build natively within Visual Studio using Debug or Release or any other configuration that is not used by RTC Build Definition.
if $(fetchDestination) NEQ '' ($(AntCommand) -DactivityLabel=Starting_$(AssemblyName) $(propertyFile) $(jazzbuildxml) startActivity)
if $(fetchDestination) NEQ '' ($(AntCommand) -DactivityLabel=Finished_$(AssemblyName) $(propertyFile) $(jazzbuildxml) publishActivity)
RTCBuildDebug
/property:fetchDestination=${team.scm.fetchDestination}
${team.scm.fetchDestination}
build.properties or C:\yourdir\build.properties (The path is what you defined in CommonProperties.xml with propertyFile variable)
jbe -repository https://server-vs.ibm.com:9443/ccm -userId jazzadmin -pass jazzadmin -engineId VS-Build-Engine -verbose
This setup is complete. You can now use the Jazz Ant Task in your Microsoft Visual Studio Builds.
Status icon key: