Implementing VB6 on TFS
I just finished implementing VB6 build for my client. It was pretty easy, but I learned a few things.
To do it, I simply added the source code to Version Control (naturally). Then created a build type like any but with one exception. Obviously I couldn't use the "Create Project File" Wizard, since there will be no SLN Solution file to find, so I created the TFSBuild.proj entirely manually before creating the Build Type. In that project I added the following:
PropertyGroup>
<VB6>$(ProgramFiles)\Microsoft Visual Studio\VB98\VB6.exe</VB6>
<VB6Output>$(BinariesRoot)\VB6\</VB6Output>
<VB6Timeout>150000</VB6Timeout>
</PropertyGroup>
<ItemGroup>
<ProjectToBuild Include="$(SolutionRoot)\Source\[ApplicationDirectory]\{application].vbp"></ProjectToBuild>
</ItemGroup>
<Target Name="CoreCompile">
<Message Text="CompileProject: %(ProjectToBuild.Identity)"/>
<MakeDir Directories="$(VB6Output)" Condition="!Exists('$(VB6Output)')"/>
<Exec Condition=" '@(ProjectToBuild)'!='' "
Command=""$(VB6)" /m "%(ProjectToBuild.Identity)" /outdir "$(VB6Output)" /out "$(VB6Output)VB6.log""
Timeout="$(VB6Timeout)"/>
</Target>
With that, I got a good VB6 Build!
The next thing I did was put the standard customization the client uses for it's Build Number/Version Stamping. Once the Build Number was calculated, we edit files appropriately to get that into the EXE's and DLL's - the heavy lifting done using the Tigris MSBuild Community Tasks. This always worked fine but when I added it to my VB6 Solution, VB6 wouldn't compile with the message:
The project file 'c:\TFSBuild\23\Sources\Source\[ApplicationDirectory]\[application].vbp' contains invalid key 'Type'.
With a "garbage" character in front of the capital "T" of Type.
Well once again, the same issue I blogged about a few months ago: UTF-8 is not ASCII! Evidently VB6 can't handle UTF-8 encoded files, which is the default in .NET. Fortunately, the <FileUpdate> tasks exposes the "Encoding" Property to the tasks, so specifying "Encoding=ascii" solved the problem!
The other issue I had was with the installer for the TFS MSSCCI Provider. This is a plug-in for "legacy" applications (like Visual Studio 6 and Visual Studio 2003 for example) to use TFS. I had installed an earlier version (and had successfully checked-in and out VB6 modules from VS6 and TFS Version Control). I saw that a new version of the Provider was released in early August (to support SP1 of TFS2008 I would guess in addition to some new features) - so I installed it. It had an MSI - so I assumed that it could handle dealing with earlier versions.
I then tried to check-out files and got a cryptic error:
"method not found: Void Microsoft.TeamFoundation.Msscci.Client.Context.EditItems(System.String[], Microsoft.TeamFoundation.VersionControl.Client.RecursionType, Microsoft.TeamFoundation.VersionControl.Client.LockLevel,"
Using Reflector I found that, in fact, such an overload did not exist. So after some digging I noticed two entries in "Add/Remove Programs" for the MSSCCI Provider. Evidently installing the new version on top of the old one breaks it. Here is what I had to do to fix it:
Uninstall one of the Entries in Add/Remove Programs
If you try to uninstall the second (now only remaining one) you get an error - so -
Double-click the installer (MSI) for the second one, and choose "Repair"
Now you can uninstall the remaining entry
Install the newest version
Voilà, the MSSCCI provider works find in VB6 (or anywhere else for that matter). So the moral of the story, if you use TFS with the provider, whenever a new release comes out, make sure to manually unintall it before installing the new one.