views:

325

answers:

2

I have a solution in Visual Studio which contains several projects. I'd like to run a command at the very beginning of every build - no matter which projects are involved and whether or not they are up-to-date.

Essentially I need something similar to a solution-wide pre-build event, but unfortunately VS does not appear to support these. Does anyone know an alternative way of achieving what I need?

+2  A: 

We do this by adding an empty project and setting build events for this project. Then you have to give each project dependency to this empty project to make sure that it gets built everytime.

erelender
+4  A: 

Unusual requirement. But it can be done. Add a new project to your solution, use the General + Makefile Project template. Set its NMake + Build Command Line setting to the commands you want to execute. Use Project + Project Dependencies to make all other projects depend on it.

Hans Passant