Most of the time I am doing several distinct developments on the same project and, in order to have some logical separation between them, I use a personal version control system on a project (namely fossil but this is mabye too much detail).
This allows me to commit my work in different branches in order to merge them afterwards. Meanwhile I maintain a trunk branch in which I commit work by coworkers.
But when I switch from a branch to another one (in order to perform some merge action for instance) and go back to where I came from, Visual studio will detect timestamp modifications and rebuild files that have not really be modified.
Is there a way to ask Visual Studio to consider that a source file has changed when only some hash of its contents has changed?
As the answer seems to be “no” here is another way of achieving what I would like, for which I am starting a bounty. Still read the above please.
Do you know of a simple way to have a snapshot of the timestamps and MD5 hashes of my source files, and then, for every file of which the timestamp changed, compare MD5 and rollback timestamp modification if MD5 has not changed?
Thank you for your answers.
I'm afraid this is not really possible.
The issue here is that this is not just a thing for VS but actually for the entire build system which is quite separate from the actual IDE.
In order to decide if and .obj
should be compiled, VS compares its timestamp to that of the source file. Doing what you suggest will require the .obj
file to include the MD5 of the file. This also goes for .exe
and .dll
files. Changing the binary format of these files and unlikely to happen for such a rarely needed feature.
Edit - I take it back, this is probably is possible in theory. One way to go is to write a VS plugin. The plugin would save the MD5s to some file in the output directory and the just before the build starts will update the modified dates of the appropriate files.
Thinking further, this might be possible using a pre-build step..?
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