Is there a way to force Visual studio to rebuild a specific file on every build?
I have a version header with __DATE__
and __TIME__
and I want it automatically updated for each release.
I can do a prebuild event and a batch file to touch
the file, just wondered if there was a feature to do this yet?
You can also delete the .obj
file with a pre-build step. It will cause the compiler to rebuild your .cpp
or .h
file. Right click your project > Properties > Build events > Pre-Build Event > Command Line and add the following line:
del $(TargetDir)source.obj
From superuser, try adding a prebuild command:
copy /b filename.ext +,,
Where filename.ext
is the path/name of the header you want touched. Caveat: I'm not certain VStudio always executes prebuild events, or only if it detects it actually needs to do a build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With