MsBuild可以输出类似于makedepend的依赖信息吗?
有没有办法强制 MsBuild 以类似于 makedepend 的结构化形式输出目标依赖信息?对于包含 C# 和 C++ 项目的解决方案,我需要在解决方案级别使用它。我对输出格式并不挑剔。
我认为 C# 依赖关系可以通过处理 .csproj 文件并构建 DAG 来确定。同样,我可以在 C++ 源代码上运行开源 makedepend
并从那里开始。我真的不想在这里自己动手——这似乎是 MsBuild 应该能够做到的事情,即使是为了诊断目的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题,没有太多的牦牛剃毛。显然,MsBuild 在构建期间确实具有依赖项信息,因此我的方法是使用自定义目标包装构建,该目标将依赖项写入 .depends 文件:
这并不像我希望的 C++ 项目那样强大(它缺少包含的内容)头文件和链接库依赖项),但可能还可以进一步增强。我相信这对于 C# 来说是一种非常可靠的方法——它包括引用的程序集、嵌入式资源和内容。
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.