The Scenario
My project has a post-build phase set up to run a batch file, which reads a text file "version.txt". The batch file uses the information in version.txt to inject the DLL with a version block using this tool.
The version.txt is included in my project to make it easy to modify. It looks a bit like this:
@set #Description="TankFace Utility Library"
@set #FileVersion="0.1.2.0"
@set #Comments=""
Basically the batch file renames this file to version.bat, calls it, then renames it back to version.txt afterwards.
The Problem
When I modify version.txt (e.g. to increment the file version), and then press F7, the build is not seen as out-of-date, so the post-build step is not executed, so the DLL's version doesn't get updated.
I really want to include the .txt file as an input to the build, but without anything actually trying to use it.
If I #include the .txt file from a CPP file in the project, the compiler fails because it obviously doesn't understand what "@set" means.
If I add /* ... */ comments around the @set commands, then the batch file has some syntax errors but eventually succeeds. But this is a poor solution I think.
So... how would you do it?