在MSVC 2010项目中的每个文件上运行预构建事件

时间:2022-08-05 23:08:01

I'm trying to get Visual Studio 2010 to execute a FOR loop - just like the ones that can be done in a .bat file - as a pre-build event command... No luck this far.

我正在尝试让Visual Studio 2010执行FOR循环 - 就像可以在.bat文件中完成的那样 - 作为预构建事件命令......到目前为止没有运气。

Long story short, I'm trying to get Qt's moc.exe to iterate on all my header files at build time. If this work, another thing to achieve would be to include the generated moc_*.cpp files in the build process, but I'm not quite there right now.

长话短说,我试图让Qt的moc.exe在构建时迭代我的所有头文件。如果这项工作,要实现的另一件事是在构建过程中包含生成的moc _ * .cpp文件,但我现在还不是很好。

Any idea ? Thanks a lot !

任何的想法 ?非常感谢 !

1 个解决方案

#1


0  

Anyway you have to write msbuild script target for this and run as BeforeBuild target of project.

无论如何,你必须为此编写msbuild脚本目标并作为项目的BeforeBuild目标运行。

When you build a project that contains several files, you can list each file separately in the project file, or you can use wildcards to include all the files in one directory or a nested set of directories.

构建包含多个文件的项目时,可以在项目文件中单独列出每个文件,也可以使用通配符将所有文件包含在一个目录或一组嵌套目录中。

See more here How to: Select the Files to Build

在此处查看更多如何:选择要构建的文件

#1


0  

Anyway you have to write msbuild script target for this and run as BeforeBuild target of project.

无论如何,你必须为此编写msbuild脚本目标并作为项目的BeforeBuild目标运行。

When you build a project that contains several files, you can list each file separately in the project file, or you can use wildcards to include all the files in one directory or a nested set of directories.

构建包含多个文件的项目时,可以在项目文件中单独列出每个文件,也可以使用通配符将所有文件包含在一个目录或一组嵌套目录中。

See more here How to: Select the Files to Build

在此处查看更多如何:选择要构建的文件