Friday, October 12, 2007

Automated builds of Visual Basic 6 project with Team System

Way back when we started to implement TFS as our primary provider for source control and build automation we experienced a fair ammount of pain due to the fact that we had a large body of Visual Basic 6 code that we needed to build using Team Build.

Since there is still not that much information about this I decided to do a post about it.

There are not that much to it but it has one quirk that you need to understand to get it to run smoothly. You have to use the /out argument and supply a path to a logfile that will capture the input.

It's rather easy to say nah I don't need that information and run without using this argument. The problem then will start with the fact that even if you build vb6 projects using the commandline switches the IDE will prompt for input when failures occurs and block the build script indefinitly. It wont work just using the timeout property on the exec task either since this will leave the process running and locking the files and thus you will get a failed build the next time when Team Build attempts to clear the workspace.

Using the exec task

"This approach requires no external components but does not report any information back in the build report"

<VB6>$(ProgramFiles)\Microsoft Visual Studio\VB98\VB6.exe</vb6>

<target name="CompileProject"
   outputs="Compiled %(ProjectToBuild.Identity)">

<message text="CompileProject: %(ProjectToBuild.Identity)">
<makedir directories="$(VB6Output)" condition="!Exists('$(VB6Output)')">

<exec condition=" '@(ProjectToBuild)'!='' "
      /m "%(ProjectToBuild.Identity)"
      /outdir "$(VB6Output)"
      /out "$(VB6Output)VB6.log""


Using a custom build task

"This approach requires and external component which is included in my petproject TfsBuildLab. The benefits with this is that the feedback is instant in the build report. Pleas note that the script below describes what the usage would look like using the build task VB6Build"

<VB6>$(ProgramFiles)\Microsoft Visual Studio\VB98\VB6.exe</vb6>

<Target Name="CompileProject"
   Outputs="Compiled %(ProjectToBuild.Identity)" >

<Message Text="CompileProject: %(ProjectToBuild.Identity)" />
<MakeDir Directories="$(VB6Output)" Condition="!Exists('$(VB6Output)')" />

<VB6Build TeamFoundationUrl="$(TeamFoundationServerUrl)"
   Output="$(VB6Output)" />


Finally here are some links to a couple of postings that has been usefull for me when dealing with issues regarding building none Visual Studio 2005 related solutions...

Building Non-MSBuild Projects With Team Build by Aaron Hallberg
Team Build DevEnv Task by Aaron Hallberg

Building binaries targeting .NET 1.1 and .NET 1.0 in TeamBuild by Nagaraju Palla

No comments:

Post a Comment