Friday, February 13, 2009

Multiple Solutions in Visual Studio and C++/CLI

Whilst investigating the restructuring of Keima's codebase, I happened upon the "Team Development with TFS Guide" - an online resource for people who want to understand best practice for Visual Studio and TFS.

It covers the problem of project and solution organization in some depth along with the related topic of project references vs. file references. The "Partitioned Solution" option seemed very interesting as it allows you to break down an existing monolithic solution into smaller solutions, but still retain the ability to do inter-project links. As long as you manage the links in a master solution, those project links will be respected when building the projects via the sub-solutions even though the reference project is not present. In fact the project reference looks broken in the IDE (with a yellow warning triangle and everything), but it still builds.

All fine and dandy for C# projects, but as regular viewers will know we have some C++/CLI projects in our codebase. Ever the red-headed step-child, links from any sub-solution project to a C++/CLI project in a different solution will not work. When building from the IDE this manifests as them simply not being present on the command line, with no warning that this might cause compilation errors. When building from MSBuild this is slightly more verbose: "MSBuild cannot resolve the reference to the Visual C++ project".

Doubly annoying that none of the error messages have meaningful error numbers, hence this verbose blog post for future me to find when developer amnesia has wiped this sorry incident from my brain and I am trying to do exactly the same thing (i.e. two weeks from now).

I have no clue why this limitation exists. It probably has something to do with the poor relationship between CLR and C++ build systems. Yet again I find myself in the tiny subset of people who use all of these technologies simultaneously.

1 comment:

Yoooder said...
This comment has been removed by the author.