Reputation: 16081
We have a few hundred visual studio project files that I need to assemble into a solution for building. We currently have a custom ruby script, that uses rake, to do this. But is fragile, and only allows a few visual studio macros ( $(TargetDir),$(TargetName), etc...) through, and failing on the rest. Plus the grammar of Ruby rubs me like Perl: The wrong way.
So my question is, given a directory is there a tool that will recursively find all all the .vcxproj and .csproj files and generate a solution file with dependencies? When I say 'with dependencies' it means that some projects need to be built before others. I found some other posts here on stack overflow that pointed to a tool that generates solution files: but it doesn't generate dependencies. Therefore without dependencies any solution creation tool is completely useless. Does anyone know of something that will do this?
If not a solution file, does anyone know of something that will just emit a dependency list?
P.S. And before anyone asks: creating a solution file manually is completely out of the question. We simply have way too many project files.
Upvotes: 3
Views: 1400
Reputation: 13842
On a side note, having hundreds of VS projects is a bad idea, it will kill VS performances, see the two white-books:
Upvotes: 0
Reputation: 5949
So my question is, given a directory is there a tool that will recursively find all all the .vcxproj and .csproj files and generate a solution file with dependencies?
No.
What you're asking for is very reasonable; your approach to the problem is quite rational. Unfortunately, the tools haven't kept up with you. (We had the same problem.)
You're going to have to script that yourself, or otherwise customize tools. That's what we did. Successful approaches I've seen include:
Generate the *.vcproj/*.sln
from
"reference project definitions",
using tools like CMake
, QMake
, Scons
, or
Gyp
. Our main system currently sits
on Scons
, with our custom Python
code to navigate these dependencies,
generate solutions based on projects
(spidering dependencies). By
default, we generate a "complete"
solution for each project (including
all required supporting projects),
plus a "Master All Projects"
solution. It works very well. But,
it was custom work that took effort,
and we extended Scons
somewhat to
describe our projects (but we simply
rely on the Scons
generation of
*.sln
and *.vcproj
).
Write a custom tool to "find" these dependencies by
parsing all the *.vcproj
files in
your workspace. This is work, but can be done. Those files can be "tricky" to navigate, but you might be fine with a "good enough" solution that uses the GUIDs as hash keys to generate those dependencies.
I totally agree with you: This type of stuff (project dependencies) is prohibitively difficult to maintain manually when you move beyond "simple" (e.g., many dozens of projects, yes, we also have hundreds).
Sorry. MSVS is a pretty good IDE (intended for iterative development), and a terrible build configuration management system, and not designed to do what we're talking about.
Because I care about your sanity and Your Everlasting Soul, please Please PLEASE do not attempt to write your custom solution in MSBuild.
Upvotes: 3