0

I am working on a fairly large C++ application using a VS2015 solution comprising of multiple projects. I've created a python script to automatically generate version.h to include GIT information to be passed to a legacy app I have no control over as a #define (I currently cannot do this any other way).

The problem I'm having is that the pre-build event takes place but VS does not include the new file in the build until I press build a second time.

Research so far has suggested this may be because Visual Studio is building from it's copy of the solution in memory as opposed to what's stored on my disk.

I'd welcome any help or suggestions of better solution as I feel this is a little hacky

jdenny
  • 63
  • 3
  • Have you tried executing the script on an earlier stage, for example on BeforeBuild target? You can check the sequence described [here](http://stackoverflow.com/questions/5926311/what-is-the-difference-between-a-prebuildevent-beforebuild-target-and-beforecom). BTW are you compiling from `vs` or via `msbuild` command directly? – Dusteh Jan 12 '17 at 09:13
  • @Dusteh Both - msbuild is called via Maven which injects version numbers into the pre-processor which version.h will use if they're defined else if compiling straight from VS it'll use the git branch. I looked at the sequence you mentioned. I believe that solution is .net only? – jdenny Jan 12 '17 at 09:19

0 Answers0