Perhaps you could add a Pre-Build Step , which is a touch (see this thread ) file?
To add a Pre-Build Step , open Project Properties , then Configuration Properties > Build Events > Pre-Build Event , then add the command line that you want to run on the Command Line .
Following Amitd's suggestion, you can also touch use the file using PowerShell, see this one for explanations.
As suggested by Adrian McCarthy in the comments below, deleting the .obj file would be preferable in the context of using the control source, and you want to keep the .cpp read-only . Using the "macros" exposed by Visual Studio, removing them can be simplified:
del $(TargetDir)sourcefile.obj
Quote from Cheers and hth. - Alf as another way to achieve this
nmake (bundled with Visual Studio and the SDK) option /t does a touch, it was once the conventional way to do this for Windows programmers.
emartel
source share