Is there a way to force MsBuild to output target dependency information in a structured form similar to makedepend? I need this at the solution level for a solution containing C# and C++ projects. I’m not picky about the output format.
I’ve considered that the C# dependencies can be determined by processing the .csproj files and building a DAG. Likewise I could run an open-source makedepend on the C++ sources and go from there. I’m really trying not to roll my own here — this seems like something that MsBuild ought to be able to just do, if even for diagnostic purposes.
I solved this without too much yak shaving. Obviously MsBuild does have the dependency info during the build so my approach is to wrap the build with a custom target that writes the dependency to a .depends file:
This is not quite as robust as I’d like for C++ projects (it lacks included header and link library dependencies) but could probably be further enhanced. I believe this is a very solid approach for C# — it includes referenced assemblies, embedded resources and content.