使用 MSBuild 管理大型项目
我需要编译大量项目(其中一些项目相互依赖)。当然,我可以将它们放在 Visual Studio 下的单个解决方案文件下并管理编译。但现有的解决方案并不是这样配置的。我还认为构建脚本可以更有效地管理它们。
但我找不到任何合适的工具来转换 Visual Studio 项目文件,该文件在 MSBuild 脚本文件中包含我所需的所有设置。手动添加每个文件是一项繁琐的任务。
我的问题是
- 是否有任何工具可以创建和管理 MSBuild 文本文件?
- 我可以将项目文件按原样提供给 MSBuild 脚本进行编译吗?
- 如果我必须手动指定源文件,如何在稍后添加新文件时同步项目文件和 MSBuild 脚本文件?
- 是否可以利用 MSBuild 的多核 CPU 并行编译独立项目?
I have a requirement for compiling large number of projects (some of them having dependency one to other). Of course I can put them under single solution file under Visual Studio and manage the compilation. But the existing solutions isn't configured in such a way. Also I feel the build scripts are better efficient to manage them.
But I could not find any proper tools to convert the Visual Studio Project files which contains all my required settings in an MSBuild Script file. Adding each and every files manually is a tedious task.
My questions are
- Are there any tools which exists to create and manage MSBuild text file?
- Can I give project files as is to the MSBuild script for compilation?
- If I have to manually specify the source files, how can I sync up the project files and MSBuild script file on adding new files later?
- Is it possible to leverage the multi-core CPUs with MSBuild to compile independent projects in parallel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下面的文章介绍了使用 MSBuild 遍历项目的替代方法。您可能想读一下:
http://msdn.microsoft.com/ en-us/magazine/dd483291.aspx
The alternative of using MSBuild traversal projects is illustrated in the following article. You may want to give this a read:
http://msdn.microsoft.com/en-us/magazine/dd483291.aspx
您可以按原样提供项目文件进行编译,但您必须注意正确的构建顺序,并且对于大量项目而言这并不简单,并且无法并行构建。
最适合您的解决方案是使用当前的解决方案使用 MSBuild 进行构建
如果您想并行构建,请将 /m:2 /p:BuildInParallel=True 参数添加到命令行中。 更多信息
You can give project files as is for compilation but you have to take care of correct build order and it is not simple for large number of projects and you cannot build in parallel.
The best solution for you is to use your current solution to build using MSBuild
If you want to build in parallel add /m:2 /p:BuildInParallel=True parameters into command line. More info