避免 VC++ 中的中间目录
我正在维护一个构建脚本,该脚本从命令行调用 devenv 或 Incredibuild,以构建由数百个项目组成的动态生成的 Visual C++ 2010 解决方案。我们正在研究改进构建的方法,我想知道是否有办法告诉 VS 避免使用中间目录。
例如,假设我在解决方案 Bar
中有一个项目 Foo
。当我构建 Bar
时,Foo
的输出最终会出现在 Bar/Foo/$(Configuration)/$(Platform)
和 <代码>栏/$(配置)/$(平台)。
我想知道是否有一种方法(从命令行或通过编辑项目文件)使 devenv 直接在解决方案的输出目录中构建并且仅在那里。另外,我有什么理由应该/不应该做这样的事情吗?
I'm maintaining a build script that calls devenv or Incredibuild from the command line to build a dynamically generated Visual C++ 2010 solution made up of several hundred projects. We're looking into ways of improving our build and I was wondering if there was a way to tell VS to avoid using intermediate directories.
For example, say I have a project Foo
in a solution Bar
. When I build Bar
, the output from Foo
ends up both in Bar/Foo/$(Configuration)/$(Platform)
and in Bar/$(Configuration)/$(Platform)
.
I'd like to know if there's a way (from the command line or by editing project files) to make devenv build directly in the solution's output directory and only there. Also, are there any reasons why I should/shouldn't do such a thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需将 .vcxproj 文件中的中间目录路径设置为与解决方案输出目录相同。
假设您的项目彼此不具有相同的输出文件名,则混合中间目录没有问题。您还可以将其设置为在 TEMP 下或其他驱动器上创建所有中间目录。
Simply set the intermediate directory path in the .vcxproj files to the same as the solution output directory.
Assuming your projects don't have the same output filename as each other there is no problem mixing intermediate directories. You can also set it to create all the intermediate directories under TEMP or on another drive.
不要那样做!!!!
由于 MSBuild 中存在一个错误(我将此行为称为错误),因此当您重建项目时,使用相同中间目录的所有项目的所有文件都将被删除
项目构建之前的输出文件夹...
DONT do that!!!!
since there is a bug (I call this behaviour a bug) in MSBuild that when you do a rebuild of a project, all files of ALL projects that use the same Intermediate Directory will be deleted in the
output folder before the project is Build...