Mixed project types in Team Foundation Server Builds

Although I mostly live in the nice and cozy world of C# I still spend some time in the land of C++. As part of my crazy idea to start using Team Foundation Server I decided to set up a nice handy one (ok, two) click build item that should get us a clean build of the complete software. The project is structured as a load of Assemblies that get loaded by the main executable (we're very component based, and hightly configurable) and all but one of these are written in C#. There is a lone C++ module that has a load of DirectShow code in it because I didn't feel like going through the hell of getting DirectShow working fully under C#. Long story short, the automatic build item from solution file doesn't quite take the C++ project into account when it generates the configuration and so that part never gets built. This has been an ideal opportunity to get to know the finer details about how the build files are organised, and I've finally figured out what it was that needs changing to get the build working. First up is the fact that the build never gets around to the C++ project. This is an omission in the file TFSBuild.proj that only takes the C# projects build type into account. This is OK for C# and, I assume VB and the like, but for C++ it's a problem. The generated file contained just the configuration "Release|Any CPU", while the C++ code needs the configuration "Release|Win32". This can be easily solved by adding the following to the .proj file:

Where it says:

<ConfigurationToBuild Include="Release|Any CPU">
   <
FlavorToBuild>Release</FlavorToBuild
>
   <
PlatformToBuild>Any CPU</PlatformToBuild
>
</
ConfigurationToBuild
>

Change it to say:

<ConfigurationToBuild Include="Release|Win32">
   <
FlavorToBuild>Release</FlavorToBuild
>
   <
PlatformToBuild>Win32</PlatformToBuild
>
</
ConfigurationToBuild>

<ConfigurationToBuild Include="Release|Any CPU">
   <
FlavorToBuild>Release</FlavorToBuild
>
   <
PlatformToBuild>Any CPU</PlatformToBuild
>
</
ConfigurationToBuild>

This will cause the C++ code to be compiled first (I assume every time, so far it has always been this way). Lucky for me our dependancies work out like this, if your C++ code depends on a C# module in the same solution and another C# project then depends on that C++ code you may be out of luck and need two solution files.

The last issue was the fact that the C++ code gets output to a different directory than the C# code. Nice easy fix this one, just open the VCOverrides.vsprops file and change the OutputDirectory property to be something like the one in this snippet by removing the "$(PlatformName)\" part of the string.

<

VisualStudioPropertySheet ProjectType="Visual C++" Version="8.00" Name="Team Build Overrides" OutputDirectory="$(BinariesRoot)\$(ConfigurationName)">

And there you have it, you now have a mix of C++ and C# code being compiled into the same directory.

I'm building upto a rant about the source control in Team Server, but I'll save that until after I've tried to code out of the office over the weekend and gotten really fed up with the lack of a disconnected mode. 

posted @ Thursday, November 24, 2005 6:02 PM

Print
Comments have been closed on this topic.